michael@0: package org.mozilla.gecko.tests; michael@0: michael@0: import org.json.JSONObject; michael@0: michael@0: public class testCheck2 extends PixelTest { michael@0: @Override michael@0: protected Type getTestType() { michael@0: return Type.TALOS; michael@0: } michael@0: michael@0: public void testCheck2() { michael@0: String url = getAbsoluteUrl("/startup_test/fennecmark/cnn/cnn.com/index.html"); michael@0: michael@0: // Enable double-tap zooming michael@0: JSONObject jsonPref = new JSONObject(); michael@0: try { michael@0: jsonPref.put("name", "browser.ui.zoom.force-user-scalable"); michael@0: jsonPref.put("type", "bool"); michael@0: jsonPref.put("value", true); michael@0: setPreferenceAndWaitForChange(jsonPref); michael@0: } catch (Exception ex) { michael@0: mAsserter.ok(false, "exception in testCheck2", ex.toString()); michael@0: } michael@0: michael@0: blockForGeckoReady(); michael@0: loadAndPaint(url); michael@0: michael@0: mDriver.setupScrollHandling(); michael@0: michael@0: /* michael@0: * for this test, we load the timecube page, and replay a recorded sequence of events michael@0: * that is a user panning/zooming around the page. specific things in the sequence michael@0: * include: michael@0: * - scroll on one axis followed by scroll on another axis michael@0: * - pinch zoom (in and out) michael@0: * - double-tap zoom (in and out) michael@0: * - multi-fling panning with different velocities on each fling michael@0: * michael@0: * this checkerboarding metric is going to be more of a "functional" style test than michael@0: * a "unit" style test; i.e. it covers a little bit of a lot of things to measure michael@0: * overall performance, but doesn't really allow identifying which part is slow. michael@0: */ michael@0: michael@0: MotionEventReplayer mer = new MotionEventReplayer(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop(), michael@0: mDriver.getGeckoWidth(), mDriver.getGeckoHeight()); michael@0: michael@0: float completeness = 0.0f; michael@0: mDriver.startCheckerboardRecording(); michael@0: // replay the events michael@0: try { michael@0: mer.replayEvents(getAsset("testcheck2-motionevents")); michael@0: // give it some time to draw any final frames michael@0: Thread.sleep(1000); michael@0: completeness = mDriver.stopCheckerboardRecording(); michael@0: } catch (Exception e) { michael@0: mAsserter.ok(false, "Exception while replaying events", e.toString()); michael@0: } michael@0: michael@0: mAsserter.dumpLog("__start_report" + completeness + "__end_report"); michael@0: System.out.println("Completeness score: " + completeness); michael@0: long msecs = System.currentTimeMillis(); michael@0: mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp"); michael@0: } michael@0: }