Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 package org.mozilla.gecko.tests;
3 import org.json.JSONObject;
5 public class testCheck2 extends PixelTest {
6 @Override
7 protected Type getTestType() {
8 return Type.TALOS;
9 }
11 public void testCheck2() {
12 String url = getAbsoluteUrl("/startup_test/fennecmark/cnn/cnn.com/index.html");
14 // Enable double-tap zooming
15 JSONObject jsonPref = new JSONObject();
16 try {
17 jsonPref.put("name", "browser.ui.zoom.force-user-scalable");
18 jsonPref.put("type", "bool");
19 jsonPref.put("value", true);
20 setPreferenceAndWaitForChange(jsonPref);
21 } catch (Exception ex) {
22 mAsserter.ok(false, "exception in testCheck2", ex.toString());
23 }
25 blockForGeckoReady();
26 loadAndPaint(url);
28 mDriver.setupScrollHandling();
30 /*
31 * for this test, we load the timecube page, and replay a recorded sequence of events
32 * that is a user panning/zooming around the page. specific things in the sequence
33 * include:
34 * - scroll on one axis followed by scroll on another axis
35 * - pinch zoom (in and out)
36 * - double-tap zoom (in and out)
37 * - multi-fling panning with different velocities on each fling
38 *
39 * this checkerboarding metric is going to be more of a "functional" style test than
40 * a "unit" style test; i.e. it covers a little bit of a lot of things to measure
41 * overall performance, but doesn't really allow identifying which part is slow.
42 */
44 MotionEventReplayer mer = new MotionEventReplayer(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop(),
45 mDriver.getGeckoWidth(), mDriver.getGeckoHeight());
47 float completeness = 0.0f;
48 mDriver.startCheckerboardRecording();
49 // replay the events
50 try {
51 mer.replayEvents(getAsset("testcheck2-motionevents"));
52 // give it some time to draw any final frames
53 Thread.sleep(1000);
54 completeness = mDriver.stopCheckerboardRecording();
55 } catch (Exception e) {
56 mAsserter.ok(false, "Exception while replaying events", e.toString());
57 }
59 mAsserter.dumpLog("__start_report" + completeness + "__end_report");
60 System.out.println("Completeness score: " + completeness);
61 long msecs = System.currentTimeMillis();
62 mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp");
63 }
64 }