Bug 738556 - Improve testCheck to use a variety of scroll amounts and more reliable dragging code. r=Cwiiis
authorKartikaya Gupta <kgupta@mozilla.com>
Fri, 23 Mar 2012 11:58:06 -0400
changeset 92021 882fc7645a590e1bbfcb6f2e32e492de482889e9
parent 92020 932cf6043b9b1f792ee7003c006eb15ecb8cf7e7
child 92022 69171a9b6c74a1884bbd13a2b844cc022c2f2f5a
push idunknown
push userunknown
push dateunknown
reviewersCwiiis
bugs738556
milestone13.0a2
Bug 738556 - Improve testCheck to use a variety of scroll amounts and more reliable dragging code. r=Cwiiis
mobile/android/base/tests/testCheck.java.in
--- a/mobile/android/base/tests/testCheck.java.in
+++ b/mobile/android/base/tests/testCheck.java.in
@@ -9,44 +9,44 @@ public class testCheck extends PixelTest
             Thread.sleep(length);
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
     }
 
     public void testCheck() {
         setTestType("talos");
-        String url = getAbsoluteUrl("/startup_test/fennecmark/wikipedia.html");
+        String url = getAbsoluteUrl("/startup_test/fennecmark/timecube.html");
 
         mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
 
         loadAndPaint(url);
 
         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()/6;
+        MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
+        int midX = mDriver.getGeckoWidth() / 2;
+        int height = mDriver.getGeckoHeight();
+        int topY = height / 8;
 
         mDriver.startCheckerboardRecording();
 
-        int i = 0;
-        // Scroll repeatedly downwards, then upwards. This test should take
-        // approximately 15 seconds.
-        do {
+        // Scroll repeatedly downwards, then upwards. On each iteration of i,
+        // increase the scroll distance to test different scroll amounts.
+        for (int i = 2; i < 7; i++) {
+            int botY = (height * i / 8);
             for (int j = 0; j < 3; j++) {
-                mActions.drag(midX, midX, midY, endY);
-                pause(500);
+                meh.dragSync(midX, botY, midX, topY, 200);
+                pause(1000);
             }
             for (int j = 0; j < 3; j++) {
-                mActions.drag(midX, midX, endY, midY);
-                pause(500);
+                meh.dragSync(midX, topY, midX, botY, 200);
+                pause(1000);
             }
-            i++;
-        } while (i < 5);
+        }
 
         float completeness = mDriver.stopCheckerboardRecording();
         mAsserter.dumpLog("__start_report" + completeness + "__end_report");
         long msecs = System.currentTimeMillis();
         mAsserter.dumpLog("__startTimestamp" + msecs + "__endTimestamp");
     }
 }