mobile/android/base/tests/testCheck2.java

Wed, 31 Dec 2014 07:22:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:22:50 +0100
branch
TOR_BUG_3246
changeset 4
fc2d59ddac77
permissions
-rw-r--r--

Correct previous dual key logic pending first delivery installment.

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

mercurial