Bug 1058243 - (Part 2) Update testAddonManager to open a blank new tab instead of trying to click link in about:addons. r=nalexander
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Tue, 07 Oct 2014 11:52:56 -0700
changeset 233737 92bcf77b60ed876b8277d5b67526c2d8ad1bc836
parent 233736 c1cef1625a48b4c5354041d3b451ae85d2648905
child 233738 9c56c35657b9eb4f115c4423b2acb435c5ce0d40
push id611
push userraliiev@mozilla.com
push dateMon, 05 Jan 2015 23:23:16 +0000
treeherdermozilla-release@345cd3b9c445 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnalexander
bugs1058243
milestone35.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 1058243 - (Part 2) Update testAddonManager to open a blank new tab instead of trying to click link in about:addons. r=nalexander
mobile/android/base/tests/testAddonManager.java
--- a/mobile/android/base/tests/testAddonManager.java
+++ b/mobile/android/base/tests/testAddonManager.java
@@ -1,22 +1,24 @@
 package org.mozilla.gecko.tests;
 
 import org.json.JSONObject;
 import org.mozilla.gecko.Actions;
 
 import android.util.DisplayMetrics;
 
+/**
+ * This test performs the following steps to check the behavior of the Add-on Manager:
+ *
+ * 1) Open the Add-on Manager from the Add-ons menu item, and then close it.
+ * 2) Open the Add-on Manager by visiting about:addons in the URL bar.
+ * 3) Open a new tab, select the Add-ons menu item, then verify that the existing
+ *    Add-on Manager tab was selected, instead of opening a new tab.
+ */
 public class testAddonManager extends PixelTest  {
-    /* This test will check the behavior of the Addons Manager:
-    First the test will open the Addons Manager from the Menu and then close it
-    Then the test will open the Addons Manager by visiting about:addons
-    The test will tap/click on the addons.mozilla.org icon to open the AMO page in a new tab
-    With the Addons Manager open the test will verify that when it is opened again from the menu no new tab will be opened*/
-
     public void testAddonManager() {
         Actions.EventExpecter tabEventExpecter;
         Actions.EventExpecter contentEventExpecter;
         String url = StringHelper.ABOUT_ADDONS_URL;
 
         blockForGeckoReady();
 
         // Use the menu to open the Addon Manger
@@ -38,44 +40,22 @@ public class testAddonManager extends Pi
 
         // Close the Add-on Manager
         mActions.sendSpecialKey(Actions.SpecialKey.BACK);
 
         // Load the about:addons page and verify it was loaded
         loadAndPaint(url);
         verifyPageTitle(StringHelper.ADDONS_LABEL);
 
-        // Change the AMO URL so we do not try to navigate to a live webpage
-        JSONObject jsonPref = new JSONObject();
-        try {
-            jsonPref.put("name", "extensions.getAddons.browseAddons");
-            jsonPref.put("type", "string");
-            jsonPref.put("value", getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL));
-            setPreferenceAndWaitForChange(jsonPref);
-
-        } catch (Exception ex) { 
-            mAsserter.ok(false, "exception in testAddonManager", ex.toString());
-        }
-
-        // Load AMO page by clicking the AMO icon
-        DisplayMetrics dm = new DisplayMetrics();
-        getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
-
-        /* Setup the tap to top value + 25px and right value - 25px.
-        Since the AMO icon is 50x50px this values should set the tap
-        in the middle of the icon */
-        float top = mDriver.getGeckoTop() + 25 * dm.density;;
-        float right = mDriver.getGeckoLeft() + mDriver.getGeckoWidth() - 25 * dm.density;;
-
         // Setup wait for tab to spawn and load
         tabEventExpecter = mActions.expectGeckoEvent("Tab:Added");
         contentEventExpecter = mActions.expectGeckoEvent("DOMContentLoaded");
 
-        // Tap on the AMO icon
-        mSolo.clickOnScreen(right, top);
+        // Open a new tab
+        addTab(getAbsoluteUrl(StringHelper.ROBOCOP_BLANK_PAGE_01_URL));
 
         // Wait for the new tab and page to load
         tabEventExpecter.blockForEvent();
         contentEventExpecter.blockForEvent();
 
         tabEventExpecter.unregisterListener();
         contentEventExpecter.unregisterListener();