michael@0: package org.mozilla.gecko.tests; michael@0: michael@0: michael@0: /** michael@0: * A panning performance test. michael@0: * Drags the page a bunch of times and measures the frames per second michael@0: * that fennec draws at. michael@0: */ michael@0: public class testPan extends PixelTest { michael@0: @Override michael@0: protected Type getTestType() { michael@0: return Type.TALOS; michael@0: } michael@0: michael@0: public void testPan() { michael@0: String url = getAbsoluteUrl("/startup_test/fennecmark/wikipedia.html"); michael@0: michael@0: blockForGeckoReady(); michael@0: michael@0: loadAndPaint(url); michael@0: michael@0: mDriver.setupScrollHandling(); michael@0: michael@0: // Setup scrolling coordinates. michael@0: int midX = mDriver.getGeckoLeft() + mDriver.getGeckoWidth()/2; michael@0: int midY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/2; michael@0: int endY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/10; michael@0: michael@0: mDriver.startFrameRecording(); michael@0: michael@0: int i = 0; michael@0: // Scroll a thousand times or until the end of the page. michael@0: do { michael@0: mActions.drag(midX, midX, midY, endY); michael@0: try { michael@0: Thread.sleep(200); michael@0: } catch (InterruptedException e) { michael@0: e.printStackTrace(); michael@0: } michael@0: i++; michael@0: } while (i < 1000 && mDriver.getScrollHeight() + 2 * mDriver.getHeight() < mDriver.getPageHeight()); michael@0: // asserter.ok(i < 1000, "Less than 1000", "Should take less than 1000 drags to get to bottom of the page."); michael@0: michael@0: int frames = mDriver.stopFrameRecording(); michael@0: mAsserter.dumpLog("__start_report" + Integer.toString(frames) + "__end_report"); michael@0: long msecs = System.currentTimeMillis(); michael@0: mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp"); michael@0: } michael@0: }