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