2011-12-16 11:27:52 -08:00
|
|
|
#filter substitution
|
|
|
|
package @ANDROID_PACKAGE_NAME@.tests;
|
|
|
|
|
|
|
|
import @ANDROID_PACKAGE_NAME@.*;
|
|
|
|
|
2012-02-07 11:10:58 -08:00
|
|
|
/**
|
|
|
|
* A panning performance test.
|
|
|
|
* Drags the page a bunch of times and measures the frames per second
|
|
|
|
* that fennec draws at.
|
|
|
|
*/
|
|
|
|
public class testPan extends PixelTest {
|
2012-06-27 16:56:49 -07:00
|
|
|
@Override
|
|
|
|
protected int getTestType() {
|
|
|
|
return TEST_TALOS;
|
|
|
|
}
|
2012-01-05 07:20:22 -08:00
|
|
|
|
2012-01-05 07:20:22 -08:00
|
|
|
public void testPan() {
|
2012-02-02 07:09:26 -08:00
|
|
|
String url = getAbsoluteUrl("/startup_test/fennecmark/wikipedia.html");
|
2012-01-05 07:20:22 -08:00
|
|
|
|
2012-02-10 06:44:06 -08:00
|
|
|
mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
|
|
|
|
|
2012-02-07 11:10:58 -08:00
|
|
|
loadAndPaint(url);
|
|
|
|
|
2012-01-05 07:20:22 -08:00
|
|
|
mDriver.setupScrollHandling();
|
|
|
|
|
|
|
|
// Setup scrolling coordinates.
|
|
|
|
int midX = mDriver.getGeckoLeft() + mDriver.getGeckoWidth()/2;
|
|
|
|
int midY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/2;
|
|
|
|
int endY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/10;
|
|
|
|
|
|
|
|
mDriver.startFrameRecording();
|
|
|
|
|
|
|
|
int i = 0;
|
|
|
|
// Scroll a thousand times or until the end of the page.
|
|
|
|
do {
|
|
|
|
mActions.drag(midX, midX, midY, endY);
|
|
|
|
try {
|
|
|
|
Thread.sleep(200);
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
e.printStackTrace();
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
} while (i < 1000 && mDriver.getScrollHeight() + 2 * mDriver.getHeight() < mDriver.getPageHeight());
|
|
|
|
// asserter.ok(i < 1000, "Less than 1000", "Should take less than 1000 drags to get to bottom of the page.");
|
|
|
|
|
|
|
|
int frames = mDriver.stopFrameRecording();
|
2012-01-07 15:41:08 -08:00
|
|
|
mAsserter.dumpLog("__start_report" + Integer.toString(frames) + "__end_report");
|
2012-01-05 07:20:22 -08:00
|
|
|
long msecs = System.currentTimeMillis();
|
2012-01-07 15:41:08 -08:00
|
|
|
mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp");
|
2011-12-16 11:27:52 -08:00
|
|
|
}
|
|
|
|
}
|