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.

     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 }

mercurial