1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/base/tests/testPan.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +package org.mozilla.gecko.tests; 1.5 + 1.6 + 1.7 +/** 1.8 + * A panning performance test. 1.9 + * Drags the page a bunch of times and measures the frames per second 1.10 + * that fennec draws at. 1.11 + */ 1.12 +public class testPan extends PixelTest { 1.13 + @Override 1.14 + protected Type getTestType() { 1.15 + return Type.TALOS; 1.16 + } 1.17 + 1.18 + public void testPan() { 1.19 + String url = getAbsoluteUrl("/startup_test/fennecmark/wikipedia.html"); 1.20 + 1.21 + blockForGeckoReady(); 1.22 + 1.23 + loadAndPaint(url); 1.24 + 1.25 + mDriver.setupScrollHandling(); 1.26 + 1.27 + // Setup scrolling coordinates. 1.28 + int midX = mDriver.getGeckoLeft() + mDriver.getGeckoWidth()/2; 1.29 + int midY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/2; 1.30 + int endY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/10; 1.31 + 1.32 + mDriver.startFrameRecording(); 1.33 + 1.34 + int i = 0; 1.35 + // Scroll a thousand times or until the end of the page. 1.36 + do { 1.37 + mActions.drag(midX, midX, midY, endY); 1.38 + try { 1.39 + Thread.sleep(200); 1.40 + } catch (InterruptedException e) { 1.41 + e.printStackTrace(); 1.42 + } 1.43 + i++; 1.44 + } while (i < 1000 && mDriver.getScrollHeight() + 2 * mDriver.getHeight() < mDriver.getPageHeight()); 1.45 + // asserter.ok(i < 1000, "Less than 1000", "Should take less than 1000 drags to get to bottom of the page."); 1.46 + 1.47 + int frames = mDriver.stopFrameRecording(); 1.48 + mAsserter.dumpLog("__start_report" + Integer.toString(frames) + "__end_report"); 1.49 + long msecs = System.currentTimeMillis(); 1.50 + mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp"); 1.51 + } 1.52 +}