Check for redirect before calling getEntity().

EntityContent::getEntity() will fail if the content is a redirect,
so calls to getEntity() need to be guarded against this case.

NOTE: this adds more uglyness to the setup code in ActionTestCase.
There seems to be no good way to avoid this at the moment.

Bug: 66030
Change-Id: I00dd55c02dccf9467f8ff3895392a1b287355c1d
Merge "Check for redirect before calling getEntity()."