Support running tests on PhantomJS

Change-Id: I32bda24fbb8a104a9867b7889a74d3c159bbf516