Bug 725787 - Robotium: loadUrl should be callable more than one time r=gbrown
authorMark Finkle <mfinkle@mozilla.com>
Fri, 10 Feb 2012 09:44:06 -0500
changeset 86734 7422761d5b90475a08a2e65845507a44a654067d
parent 86733 c09af9f27313980150073c0e1fcb55a807d06089
child 86735 38a007426ee26b2c51eec4af6f77bbb3a8c5fe9e
push id102
push userMs2ger@gmail.com
push dateFri, 10 Feb 2012 20:38:19 +0000
reviewersgbrown
bugs725787
milestone13.0a1
Bug 725787 - Robotium: loadUrl should be callable more than one time r=gbrown
mobile/android/base/tests/BaseTest.java.in
mobile/android/base/tests/testAwesomebar.java.in
mobile/android/base/tests/testAxisLocking.java.in
mobile/android/base/tests/testBookmark.java.in
mobile/android/base/tests/testCheck.java.in
mobile/android/base/tests/testFlingCorrectness.java.in
mobile/android/base/tests/testLoad.java.in
mobile/android/base/tests/testOverscroll.java.in
mobile/android/base/tests/testPan.java.in
mobile/android/base/tests/testPanCorrectness.java.in
mobile/android/base/tests/test_bug720538.java.in
--- a/mobile/android/base/tests/BaseTest.java.in
+++ b/mobile/android/base/tests/BaseTest.java.in
@@ -99,18 +99,16 @@ abstract class BaseTest extends Activity
     }
 
     protected final Activity clickOnAwesomeBar() {
         Element awesomebar = mDriver.findElement(mActivity, "awesome_bar");
         return getActivityFromClick(awesomebar);
     }
 
     protected final void enterUrl(String url) {
-        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
-
         Activity awesomeBarActivity = clickOnAwesomeBar();
         Element urlbar = mDriver.findElement(awesomeBarActivity, "awesomebar_text");
         mActions.sendKeys(url);
         mAsserter.is(urlbar.getText(), url, "Awesomebar URL typed properly");
     }
 
     protected final void hitEnterAndWait() {
         Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
--- a/mobile/android/base/tests/testAwesomebar.java.in
+++ b/mobile/android/base/tests/testAwesomebar.java.in
@@ -2,16 +2,18 @@
 package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 
 public class testAwesomebar extends BaseTest {
     public void testAwesomebar() {
         setTestType("mochitest");
 
+        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
+
         String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
         loadUrl(url);
 
         mDriver.setupScrollHandling();
         // Calculate where we should be dragging.
         int midX = mDriver.getGeckoLeft() + mDriver.getGeckoWidth()/2;
         int midY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/2;
         int endY = mDriver.getGeckoTop() + mDriver.getGeckoHeight()/10;
--- a/mobile/android/base/tests/testAxisLocking.java.in
+++ b/mobile/android/base/tests/testAxisLocking.java.in
@@ -14,16 +14,18 @@ import android.app.Instrumentation;
  */
 public class testAxisLocking extends PixelTest {
     public void testAxisLocking() {
         setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
         MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
 
+        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
+
         // load page and check we're at 0,0
         loadAndVerifyBoxes(url);
 
         // drag page upwards by 100 pixels with a slight angle. verify that
         // axis locking prevents any horizontal scrolling
         Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
         meh.dragSync(20, 150, 10, 50);
         int[][] painted = waitForPaint(paintExpecter);
--- a/mobile/android/base/tests/testBookmark.java.in
+++ b/mobile/android/base/tests/testBookmark.java.in
@@ -7,16 +7,19 @@ import android.widget.TextView;
 import android.os.SystemClock;
 import java.util.ArrayList;
 
 public class testBookmark extends BaseTest {
     private static final long MAX_WAIT_MS = 10 * 1000; 
 
     public void testBookmark() {
         setTestType("mochitest");
+
+        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
+
         String url = getAbsoluteUrl("/robocop/robocop_blank_02.html");
         enterUrl(url);
 
         //Click the top item in the awesome list.
         mActions.sendSpecialKey(Actions.SpecialKey.DOWN);
         hitEnterAndWait();
 
         //Click the top item in the bookmark list.
--- a/mobile/android/base/tests/testCheck.java.in
+++ b/mobile/android/base/tests/testCheck.java.in
@@ -10,16 +10,19 @@ public class testCheck extends PixelTest
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
     }
 
     public void testCheck() {
         setTestType("talos");
         String url = getAbsoluteUrl("/startup_test/fennecmark/wikipedia.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;
--- a/mobile/android/base/tests/testFlingCorrectness.java.in
+++ b/mobile/android/base/tests/testFlingCorrectness.java.in
@@ -12,16 +12,18 @@ import android.app.Instrumentation;
  */
 public class testFlingCorrectness extends PixelTest {
     public void testFlingCorrectness() {
         setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
         MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
 
+        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
+
         // load page and check we're at 0,0
         loadAndVerifyBoxes(url);
 
         // drag page upwards by 200 pixels (use two drags instead of one in case
         // the screen size is small)
         Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
         meh.dragSync(10, 150, 10, 50);
         meh.dragSync(10, 150, 10, 50);
--- a/mobile/android/base/tests/testLoad.java.in
+++ b/mobile/android/base/tests/testLoad.java.in
@@ -9,13 +9,15 @@ import @ANDROID_PACKAGE_NAME@.*;
  * - verifies it rendered properly
  * - verifies the displayed url is correct
  */
 public class testLoad extends PixelTest {
     public void testLoad() {
         setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
+        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
+
         loadAndVerifyBoxes(url);
 
         verifyUrl(url);
     }
 }
--- a/mobile/android/base/tests/testOverscroll.java.in
+++ b/mobile/android/base/tests/testOverscroll.java.in
@@ -12,16 +12,18 @@ import android.app.Instrumentation;
  */
 public class testOverscroll extends PixelTest {
     public void testOverscroll() {
         setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
         MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
 
+        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
+
         // load page and check we're at 0,0
         loadAndVerifyBoxes(url);
 
         // drag page downwards by 100 pixels so that it goes into overscroll.
         // wait for it to bounce back and check we're at the right spot.
         // the screen size is small). Note that since we only go into overscroll
         // and back this should NOT trigger a gecko-paint
         Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
--- a/mobile/android/base/tests/testPan.java.in
+++ b/mobile/android/base/tests/testPan.java.in
@@ -9,16 +9,18 @@ import @ANDROID_PACKAGE_NAME@.*;
  * that fennec draws at.
  */
 public class testPan extends PixelTest {
 
     public void testPan() {
         setTestType("talos");
         String url = getAbsoluteUrl("/startup_test/fennecmark/wikipedia.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()/10;
--- a/mobile/android/base/tests/testPanCorrectness.java.in
+++ b/mobile/android/base/tests/testPanCorrectness.java.in
@@ -12,16 +12,18 @@ import android.app.Instrumentation;
  */
 public class testPanCorrectness extends PixelTest {
     public void testPanCorrectness() {
         setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/robocop_boxes.html");
 
         MotionEventHelper meh = new MotionEventHelper(getInstrumentation(), mDriver.getGeckoLeft(), mDriver.getGeckoTop());
 
+        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
+
         // load page and check we're at 0,0
         loadAndVerifyBoxes(url);
 
         // drag page upwards by 100 pixels
         Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
         meh.dragSync(10, 150, 10, 50);
         int[][] painted = waitForPaint(paintExpecter);
         checkScrollWithBoxes(painted, 0, 100);
--- a/mobile/android/base/tests/test_bug720538.java.in
+++ b/mobile/android/base/tests/test_bug720538.java.in
@@ -4,16 +4,18 @@ package @ANDROID_PACKAGE_NAME@.tests;
 import @ANDROID_PACKAGE_NAME@.*;
 import android.app.Instrumentation;
 
 public class test_bug720538 extends PixelTest {
     public void test_bug720538() {
         setTestType("mochitest");
         String url = getAbsoluteUrl("/robocop/test_bug720538.html");
 
+        mActions.expectGeckoEvent("Gecko:Ready").blockForEvent();
+
         /*
          * for this test, we load the associated test_bug720538.html file. this file has two
          * iframes (painted completely blue - #0000FF) and the rest of the page is the background
          * color, which is #008000 green. When we first render the page there is an iframe in
          * the top-left corner, and when we double-tap on it it should zoom to fill the visible
          * view area leaving a little bit of space on either side. We can test for this by checking
          * a few pixels to ensure that there is some background visible on either side of the iframe.
          * Finally, when we double-tap on it to zoom out again, we need to check that the bottom of