Improve equalRange assertion and use in more places

We only need to compare from/to properties. Also check
for null ranges.

Change-Id: Ie1a0a23ab4fcb1a266a12fbb6d1e602a79f2c123
Merge "Improve equalRange assertion and use in more places"