Bug 905591 - Rename BaseTest's loadUrl to inputAndLoadUrl (r=gbrown)
authorLucas Rocha <lucasr@mozilla.com>
Mon, 19 Aug 2013 21:33:49 +0100
changeset 143564 20273eaf47db49bdf84dbb1f2042c1e85035ddd4
parent 143563 1d639fdd1f261e587e0ab701fa392db8fb2d0849
child 143565 63f9dbf0e3923e152e819fe6f00dd7370953aa7f
push id25130
push userlrocha@mozilla.com
push dateWed, 21 Aug 2013 09:41:27 +0000
treeherdermozilla-central@b2486721572e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgbrown
bugs905591
milestone26.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 905591 - Rename BaseTest's loadUrl to inputAndLoadUrl (r=gbrown)
mobile/android/base/tests/BaseTest.java.in
mobile/android/base/tests/PixelTest.java.in
mobile/android/base/tests/testAboutPage.java.in
mobile/android/base/tests/testAddSearchEngine.java.in
mobile/android/base/tests/testAwesomebar.java.in
mobile/android/base/tests/testBookmarklets.java.in
mobile/android/base/tests/testClearPrivateData.java.in
mobile/android/base/tests/testDoorHanger.java.in
mobile/android/base/tests/testHistory.java.in
mobile/android/base/tests/testMasterPassword.java.in
mobile/android/base/tests/testShareLink.java.in
mobile/android/base/tests/testThumbnails.java.in
--- a/mobile/android/base/tests/BaseTest.java.in
+++ b/mobile/android/base/tests/BaseTest.java.in
@@ -239,17 +239,17 @@ abstract class BaseTest extends Activity
     }
 
     /**
      * Load <code>url</code> by sending key strokes to the URL bar UI.
      *
      * This method waits synchronously for the <code>DOMContentLoaded</code>
      * message from Gecko before returning.
      */
-    protected final void loadUrl(String url) {
+    protected final void inputAndLoadUrl(String url) {
         enterUrl(url);
         hitEnterAndWait();
     }
 
     /**
      * Load <code>url</code> using reflection and the internal
      * <code>org.mozilla.gecko.Tabs</code> API.
      *
@@ -560,17 +560,17 @@ abstract class BaseTest extends Activity
                 }
                 return true;
             }
         }, MAX_WAIT_MS);
         mAsserter.ok(success, "waiting for add tab view", "add tab view available");
         mAsserter.ok(addTab.click(), "checking that add_tab clicked", "add_tab element clicked");
 
         // Adding a new tab opens about:home, so now we just need to load the url in it.
-        loadUrl(url);
+        inputAndLoadUrl(url);
     }
 
     public final void runOnUiThreadSync(Runnable runnable) {
         RobocopUtils.runOnUiThreadSync(mActivity, runnable);
     }
 
     /* Tap the "star" (bookmark) button to bookmark or un-bookmark the current page */
     public void toggleBookmark() {
--- a/mobile/android/base/tests/PixelTest.java.in
+++ b/mobile/android/base/tests/PixelTest.java.in
@@ -3,17 +3,17 @@ package @ANDROID_PACKAGE_NAME@.tests;
 
 import @ANDROID_PACKAGE_NAME@.*;
 
 abstract class PixelTest extends BaseTest {
     private static final long PAINT_CLEAR_DELAY = 3000; // milliseconds
 
     protected final PaintedSurface loadAndGetPainted(String url) {
         Actions.RepeatedEventExpecter paintExpecter = mActions.expectPaint();
-        loadUrl(url);
+        inputAndLoadUrl(url);
         paintExpecter.blockUntilClear(PAINT_CLEAR_DELAY);
         paintExpecter.unregisterListener();
         PaintedSurface p = mDriver.getPaintedSurface();
         if (p == null) {
             mAsserter.ok(p != null, "checking that painted surface loaded", 
                  "painted surface loaded");
         }
         return p;
--- a/mobile/android/base/tests/testAboutPage.java.in
+++ b/mobile/android/base/tests/testAboutPage.java.in
@@ -21,17 +21,17 @@ public class testAboutPage extends Pixel
         loadAndPaint(url);
 
         Element urlBarTitle = mDriver.findElement(getActivity(), URL_BAR_TITLE_ID);
         mAsserter.isnot(urlBarTitle, null, "Got the URL bar title");
         assertMatches(urlBarTitle.getText(), "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)", "page title match");
 
         // Open a new page to remove the about: page from the current tab
         url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
-        loadUrl(url);
+        inputAndLoadUrl(url);
 
         // Set up listeners to catch the page load we're about to do
         Actions.EventExpecter tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
         Actions.EventExpecter contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
 
         selectSettingsItem("Mozilla", "About (Fennec|Nightly|Aurora|Firefox|Firefox Beta)");
 
         // Wait for the new tab and page to load
--- a/mobile/android/base/tests/testAddSearchEngine.java.in
+++ b/mobile/android/base/tests/testAddSearchEngine.java.in
@@ -24,17 +24,17 @@ public class testAddSearchEngine extends
         return TEST_MOCHITEST;
     }
 
     public void testAddSearchEngine() {
         String blankPageURL = getAbsoluteUrl("/robocop/robocop_blank_01.html");
         String searchEngineURL = getAbsoluteUrl("/robocop/robocop_search.html");
 
         blockForGeckoReady();
-        loadUrl(blankPageURL);
+        inputAndLoadUrl(blankPageURL);
         waitForText("Browser Blank Page 01");
 
         // Get the searchengine data by clicking the awesomebar - this causes Gecko to send Java the list
         // of search engines.
         Actions.EventExpecter searchEngineDataEventExpector = mActions.expectGeckoEvent("SearchEngines:Data");
         focusUrlBar();
         String eventData = searchEngineDataEventExpector.blockForEventData();
         searchEngineDataEventExpector.unregisterListener();
@@ -49,17 +49,17 @@ public class testAddSearchEngine extends
         }
         final int initialNumSearchEngines = searchEngines.size();
         mAsserter.dumpLog("Search Engines list = " + searchEngines.toString());
 
         // Verify that the number of displayed search engines is the same as the one received through the SearchEngines:Data event.
         verifyDisplayedSearchEnginesCount("Browser Blank Page 01", initialNumSearchEngines);
 
         // Load the page for the search engine to add.
-        loadUrl(searchEngineURL);
+        inputAndLoadUrl(searchEngineURL);
         waitForText("Robocop Search Engine");
 
         // Used to long-tap on the search input box for the search engine to add.
         int height = mDriver.getGeckoTop() + 10;
         int width = mDriver.getGeckoLeft() + 20;
         mAsserter.dumpLog("Long Clicking at width = " + String.valueOf(width) + " and height = " + String.valueOf(height));
         mSolo.clickLongOnScreen(width,height);
         if (!waitForText("Add Search Engine")) {
--- a/mobile/android/base/tests/testAwesomebar.java.in
+++ b/mobile/android/base/tests/testAwesomebar.java.in
@@ -6,17 +6,17 @@ public class testAwesomebar extends Base
     protected int getTestType() {
         return TEST_MOCHITEST;
     }
 
     public void testAwesomebar() {
         blockForGeckoReady();
 
         String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
-        loadUrl(url);
+        inputAndLoadUrl(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;
         for (int i = 0; i < 10; i++) {
             mActions.drag(midX, midX, midY, endY);
--- a/mobile/android/base/tests/testBookmarklets.java.in
+++ b/mobile/android/base/tests/testBookmarklets.java.in
@@ -17,17 +17,17 @@ public class testBookmarklets extends Ab
         final String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
         final String title = "alertBookmarklet";
         final String js = "javascript:alert(12 + .34)";
         boolean alerted;
 
         blockForGeckoReady();
 
         // load a standard page so bookmarklets work
-        loadUrl(url);
+        inputAndLoadUrl(url);
 
         // verify that user-entered bookmarklets do *not* work
         enterUrl(js);
         mActions.sendSpecialKey(Actions.SpecialKey.ENTER);
         alerted = waitForTest(new BooleanTest() {
             @Override
             public boolean test() {
                 return mSolo.searchButton("OK", true) || mSolo.searchText("12.34", true);
--- a/mobile/android/base/tests/testClearPrivateData.java.in
+++ b/mobile/android/base/tests/testClearPrivateData.java.in
@@ -14,17 +14,17 @@ public class testClearPrivateData extend
     public void testClearPrivateData() {
         blockForGeckoReady();
         clearHistory();
     }
 
     private void clearHistory() {
         // Loading a page so we are sure that there is at least one history entry
         String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
-        loadUrl(url);
+        inputAndLoadUrl(url);
 
         /*  Removed by Bug 896576 - [fig] Remove [getHistoryList] from BaseTest
         // Checking that the history list is not empty
         ListView hList = getHistoryList("Today|Yesterday");
         mAsserter.ok(hList.getAdapter().getCount() > 0,"checking history exists","history exists");
 
         // Quit the awesomescreen
         mActions.sendSpecialKey(Actions.SpecialKey.BACK);
--- a/mobile/android/base/tests/testDoorHanger.java.in
+++ b/mobile/android/base/tests/testDoorHanger.java.in
@@ -42,37 +42,37 @@ public class testDoorHanger extends Base
 
         String LOGIN_MESSAGE = "Save password";
         String LOGIN_ALLOW = "Save";
         String LOGIN_DENY = "Don't save";
 
         blockForGeckoReady();
 
         // Test geolocation notification
-        loadUrl(GEO_URL);
+        inputAndLoadUrl(GEO_URL);
         waitForText(GEO_MESSAGE);
         mAsserter.is(mSolo.searchText(GEO_MESSAGE), true, "Geolocation doorhanger has been displayed");
 
         // Test "Share" button hides the notification
         mSolo.clickOnCheckBox(0);
         mSolo.clickOnButton(GEO_ALLOW);
         mAsserter.is(mSolo.searchText(GEO_MESSAGE), false, "Geolocation doorhanger has been hidden when allowing share");
 
         // Re-trigger geolocation notification
-        loadUrl(GEO_URL);
+        inputAndLoadUrl(GEO_URL);
         waitForText(GEO_MESSAGE);
 
         // Test "Don't share" button hides the notification
         mSolo.clickOnCheckBox(0);
         mSolo.clickOnButton(GEO_DENY);
         mAsserter.is(mSolo.searchText(GEO_MESSAGE), false, "Geolocation doorhanger has been hidden when denying share");
 
         /* FIXME: disabled on fig - bug 880060 (for some reason this fails because of some raciness)
         // Re-trigger geolocation notification
-        loadUrl(GEO_URL);
+        inputAndLoadUrl(GEO_URL);
         waitForText(GEO_MESSAGE);
 
         // Add a new tab
         addTab(BLANK_URL);
 
         // Make sure doorhanger is hidden
         mAsserter.is(mSolo.searchText(GEO_MESSAGE), false, "Geolocation doorhanger notification is hidden when opening a new tab");
         */
@@ -112,59 +112,59 @@ public class testDoorHanger extends Base
             jsonPref.put("type", "bool");
             jsonPref.put("value", false);
             mActions.sendGeckoEvent("Preferences:Set", jsonPref.toString());
         } catch (JSONException e) {
             mAsserter.ok(false, "exception getting preference", e.toString());
         }
 
         // Load offline storage page
-        loadUrl(OFFLINE_STORAGE_URL);
+        inputAndLoadUrl(OFFLINE_STORAGE_URL);
         waitForText(OFFLINE_MESSAGE);
 
         // Test doorhanger dismissed when tapping "Don't share"
         mSolo.clickOnCheckBox(0);
         mSolo.clickOnButton(OFFLINE_DENY);
         mAsserter.is(mSolo.searchText(OFFLINE_MESSAGE), false, "Offline storage doorhanger notification is hidden when denying storage");
 
         // Load offline storage page
-        loadUrl(OFFLINE_STORAGE_URL);
+        inputAndLoadUrl(OFFLINE_STORAGE_URL);
         waitForText(OFFLINE_MESSAGE);
 
         // Test doorhanger dismissed when tapping "Allow" and is not displayed again
         mSolo.clickOnButton(OFFLINE_ALLOW);
         mAsserter.is(mSolo.searchText(OFFLINE_MESSAGE), false, "Offline storage doorhanger notification is hidden when allowing storage");
-        loadUrl(OFFLINE_STORAGE_URL);
+        inputAndLoadUrl(OFFLINE_STORAGE_URL);
         mAsserter.is(mSolo.searchText(OFFLINE_MESSAGE), false, "Offline storage doorhanger is no longer triggered");
 
         try {
             // Revert offline setting
             JSONObject jsonPref = new JSONObject();
             jsonPref.put("name", "offline-apps.allow_by_default");
             jsonPref.put("type", "boolean");
             jsonPref.put("value", offlineAllowedByDefault);
             mActions.sendGeckoEvent("Preferences:Set", jsonPref.toString());
         } catch (JSONException e) {
             mAsserter.ok(false, "exception setting preference", e.toString());
         }
 
 
         // Load login page
-        loadUrl(LOGIN_URL);
+        inputAndLoadUrl(LOGIN_URL);
         waitForText(LOGIN_MESSAGE);
 
         // Test doorhanger is dismissed when tapping "Don't save"
         mSolo.clickOnButton(LOGIN_DENY);
         mAsserter.is(mSolo.searchText(LOGIN_MESSAGE), false, "Login doorhanger notification is hidden when denying saving password");
 
         // Load login page
-        loadUrl(LOGIN_URL);
+        inputAndLoadUrl(LOGIN_URL);
         waitForText(LOGIN_MESSAGE);
 
         // Test doorhanger is dismissed when tapping "Save" and is no longer triggered
         mSolo.clickOnButton(LOGIN_ALLOW);
         mAsserter.is(mSolo.searchText(LOGIN_MESSAGE), false, "Login doorhanger notification is hidden when allowing saving password");
 
         // Reload the page and check that there is no doorhanger displayed
-        loadUrl(LOGIN_URL);
+        inputAndLoadUrl(LOGIN_URL);
         mAsserter.is(mSolo.searchText(LOGIN_MESSAGE), false, "Login doorhanger is not re-triggered");
     }
 }
--- a/mobile/android/base/tests/testHistory.java.in
+++ b/mobile/android/base/tests/testHistory.java.in
@@ -18,21 +18,21 @@ public class testHistory extends AboutHo
 
     public void testHistory() {
         blockForGeckoReady();
 
         String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
         String url2 = getAbsoluteUrl("/robocop/robocop_blank_02.html");
         String url3 = getAbsoluteUrl("/robocop/robocop_blank_03.html");
 
-        loadUrl(url);
+        inputAndLoadUrl(url);
         verifyPageTitle("Browser Blank Page 01");
-        loadUrl(url2);
+        inputAndLoadUrl(url2);
         verifyPageTitle("Browser Blank Page 02");
-        loadUrl(url3);
+        inputAndLoadUrl(url3);
         verifyPageTitle("Browser Blank Page 03");
 
         openAboutHomeTab(AboutHomeTabs.MOST_RECENT);
 
         final ListView hList = findListViewWithTag("most_recent");
         mAsserter.is(waitForListToLoad(hList), true, "list is properly loaded");
 
         // Click on the history item and wait for the page to load
--- a/mobile/android/base/tests/testMasterPassword.java.in
+++ b/mobile/android/base/tests/testMasterPassword.java.in
@@ -119,23 +119,23 @@ public class testMasterPassword extends 
     public void editPasswordField(int i, String password) {
         mSolo.clickOnEditText(i);
         mActions.sendKeys(password);
         toggleVKB(); // Don't use BACK; this will close the password dialog on devices with hardware keyboard.
     }
 
     public void noDoorhangerDisplayed(String LOGIN_URL) {
         waitForText("Browser Blank Page 01|Enter Search or Address");
-        loadUrl(LOGIN_URL);
+        inputAndLoadUrl(LOGIN_URL);
         mAsserter.is(waitForText("Save password for"), false, "Doorhanger notification is hidden");
     }
 
     public void doorhangerDisplayed(String LOGIN_URL) {
         waitForText("Browser Blank Page 01|Enter Search or Address");
-        loadUrl(LOGIN_URL);
+        inputAndLoadUrl(LOGIN_URL);
         mAsserter.is(mSolo.waitForText("Save password for"), true, "Doorhanger notification is displayed");
     }
 
     // Checks to see if the device is a Tablet, because for those devices we need an extra back action to close the keyboard
     public void closeTabletKeyboard() {
         if (dev.type.equals("tablet")) {
             mSolo.sleep(1500);
             toggleVKB();// Close the keyboard for tablets
--- a/mobile/android/base/tests/testShareLink.java.in
+++ b/mobile/android/base/tests/testShareLink.java.in
@@ -30,17 +30,17 @@ public class testShareLink extends BaseT
         return TEST_MOCHITEST;
     }
 
     public void testShareLink() {
         url = getAbsoluteUrl("/robocop/robocop_big_link.html");
         ArrayList<String> shareOptions;
         blockForGeckoReady();
 
-        loadUrl(url);
+        inputAndLoadUrl(url);
         waitForText(urlTitle); // Waiting for page title to ensure the page is loaded
         selectMenuItem("Share");
         if (Build.VERSION.SDK_INT >= 14) {
             // Check for our own sync in the submenu.
             waitForText("Sync$");
         } else {
             waitForText("Share via");
         }
--- a/mobile/android/base/tests/testThumbnails.java.in
+++ b/mobile/android/base/tests/testThumbnails.java.in
@@ -41,32 +41,32 @@ public class testThumbnails extends Base
         // the session snapshot runnable is run 500ms after document stop. a
         // 3000ms delay gives us 2.5 seconds to take the screenshot, which
         // should be plenty of time, even on slow devices
         final int thumbnailDelay = 3000;
 
         blockForGeckoReady();
 
         // load sites; both will return HTTP 200 with a green background
-        loadUrl(site1Url);
+        inputAndLoadUrl(site1Url);
         mSolo.sleep(thumbnailDelay);
-        loadUrl(site2Url);
+        inputAndLoadUrl(site2Url);
         mSolo.sleep(thumbnailDelay);
-        loadUrl("about:home");
+        inputAndLoadUrl("about:home");
         waitForTest(new ThumbnailTest(site1Title, Color.GREEN), 5000);
         mAsserter.is(getTopSiteThumbnailColor(site1Title), Color.GREEN, "Top site thumbnail updated for HTTP 200");
         waitForTest(new ThumbnailTest(site2Title, Color.GREEN), 5000);
         mAsserter.is(getTopSiteThumbnailColor(site2Title), Color.GREEN, "Top site thumbnail updated for HTTP 200");
 
         // load sites again; both will have red background, and do404 will return HTTP 404
-        loadUrl(site1Url);
+        inputAndLoadUrl(site1Url);
         mSolo.sleep(thumbnailDelay);
-        loadUrl(site2Url);
+        inputAndLoadUrl(site2Url);
         mSolo.sleep(thumbnailDelay);
-        loadUrl("about:home");
+        inputAndLoadUrl("about:home");
         waitForTest(new ThumbnailTest(site1Title, Color.RED), 5000);
         mAsserter.is(getTopSiteThumbnailColor(site1Title), Color.RED, "Top site thumbnail updated for HTTP 200");
         waitForTest(new ThumbnailTest(site2Title, Color.GREEN), 5000);
         mAsserter.is(getTopSiteThumbnailColor(site2Title), Color.GREEN, "Top site thumbnail not updated for HTTP 404");
 
         // test dropping thumbnails
         try {
             ClassLoader cl = getActivity().getApplicationContext().getClassLoader();