mobile/android/base/tests/testPan.java

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 package org.mozilla.gecko.tests;
     4 /**
     5  * A panning performance test.
     6  * Drags the page a bunch of times and measures the frames per second
     7  * that fennec draws at.
     8  */
     9 public class testPan extends PixelTest {
    10     @Override
    11     protected Type getTestType() {
    12         return Type.TALOS;
    13     }
    15     public void testPan() {
    16         String url = getAbsoluteUrl("/startup_test/fennecmark/wikipedia.html");
    18         blockForGeckoReady();
    20         loadAndPaint(url);
    22         mDriver.setupScrollHandling();
    24         // Setup scrolling coordinates.
    25         int midX = mDriver.getGeckoLeft() + mDriver.getGeckoWidth()/2;
    26         int midY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/2;
    27         int endY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/10;
    29         mDriver.startFrameRecording();
    31         int i = 0;
    32         // Scroll a thousand times or until the end of the page.
    33         do {
    34             mActions.drag(midX, midX, midY, endY);
    35             try {
    36                 Thread.sleep(200);
    37             } catch (InterruptedException e) {
    38                 e.printStackTrace();
    39             }
    40             i++;
    41         } while (i < 1000 && mDriver.getScrollHeight() + 2 * mDriver.getHeight() < mDriver.getPageHeight());
    42         // asserter.ok(i < 1000, "Less than 1000", "Should take less than 1000 drags to get to bottom of the page.");
    44         int frames = mDriver.stopFrameRecording();
    45         mAsserter.dumpLog("__start_report" + Integer.toString(frames) + "__end_report");
    46         long msecs = System.currentTimeMillis();
    47         mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp");
    48     }
    49 }

mercurial