Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 package org.mozilla.gecko.tests;
3 import org.mozilla.gecko.Actions;
4 import org.mozilla.gecko.PaintedSurface;
6 /**
7 * Basic fling correctness test.
8 * - Loads a page and verifies it draws
9 * - Drags page upwards by 200 pixels to get ready for a fling
10 * - Fling the page downwards so we get back to the top and verify.
11 */
12 public class testFlingCorrectness extends PixelTest {
13 public void testFlingCorrectness() {
14 String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
16 MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
18 blockForGeckoReady();
20 // load page and check we're at 0,0
21 loadAndVerifyBoxes(url);
23 // drag page upwards by 200 pixels (use two drags instead of one in case
24 // the screen size is small)
25 Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
26 meh.dragSync(10, 150, 10, 50);
27 meh.dragSync(10, 150, 10, 50);
28 PaintedSurface painted = waitForPaint(paintExpecter);
29 paintExpecter.unregisterListener();
30 try {
31 checkScrollWithBoxes(painted, 0, 200);
32 } finally {
33 painted.close();
34 }
36 // now fling page downwards using a 100-pixel drag but a velocity of 15px/sec, so that
37 // we scroll the full 200 pixels back to the top of the page
38 paintExpecter = mActions.expectPaint();
39 meh.flingSync(10, 50, 10, 150, 15);
40 painted = waitForPaint(paintExpecter);
41 paintExpecter.unregisterListener();
42 try {
43 checkScrollWithBoxes(painted, 0, 0);
44 } finally {
45 painted.close();
46 }
47 }
48 }