Bug 989469: Fix browser_gmpProvider.js to switch views correctly. r=spohl
authorDave Townsend <dtownsend@oxymoronical.com>
Thu, 30 Apr 2015 16:28:52 -0700
changeset 273243 83909aa7f4facafed634205b51b60d411695de3c
parent 273242 b56267ff088204a483f218cd97d003f8407cdf36
child 273244 3b4fa5cc62106533d8c95fcfbbc617e2e997ff61
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl
bugs989469
milestone40.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 989469: Fix browser_gmpProvider.js to switch views correctly. r=spohl
toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
--- a/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_gmpProvider.js
@@ -64,20 +64,24 @@ function getInstallItem() {
     }
     node = node.nextSibling;
   }
 
   return null;
 }
 
 function openDetailsView(aId) {
+  let view = gManagerWindow.document.getElementById("view-port").selectedPanel
+  Assert.equal(view.id, "list-view", "Should be in the list view to use this function");
+
   let item = get_addon_element(gManagerWindow, aId);
   Assert.ok(item, "Should have got add-on element.");
   is_element_visible(item, "Add-on element should be visible.");
 
+  item.scrollIntoView();
   EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
   EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
 
   let deferred = Promise.defer();
   wait_for_view_load(gManagerWindow, deferred.resolve);
   return deferred.promise;
 }
 
@@ -160,23 +164,22 @@ add_task(function* testNotInstalledDisab
 
     let el = doc.getElementsByClassName("disabled-postfix")[0];
     is_element_visible(el, "disabled-postfix is visible.");
     el = doc.getElementById("detail-findUpdates-btn");
     is_element_visible(el, "Find updates link is visible.");
     el = doc.getElementById("detail-warning");
     is_element_hidden(el, "Warning notification is hidden.");
     el = doc.getElementsByTagName("setting")[0];
+
+    yield gCategoryUtilities.openType("plugin");
   }
 });
 
 add_task(function* testNotInstalled() {
-  Assert.ok(gCategoryUtilities.isTypeVisible("plugin"), "Plugin tab visible.");
-  yield gCategoryUtilities.openType("plugin");
-
   for (let addon of gMockAddons) {
     gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_ENABLED, addon.id), true);
     let item = get_addon_element(gManagerWindow, addon.id);
     Assert.ok(item, "Got add-on element:" + addon.id);
     item.parentNode.ensureElementIsVisible(item);
     is(item.getAttribute("active"), "true");
 
     let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning");
@@ -203,28 +206,28 @@ add_task(function* testNotInstalledDetai
 
     let el = doc.getElementsByClassName("disabled-postfix")[0];
     is_element_hidden(el, "disabled-postfix is hidden.");
     el = doc.getElementById("detail-findUpdates-btn");
     is_element_visible(el, "Find updates link is visible.");
     el = doc.getElementById("detail-warning");
     is_element_visible(el, "Warning notification is visible.");
     el = doc.getElementsByTagName("setting")[0];
+
+    yield gCategoryUtilities.openType("plugin");
   }
 });
 
 add_task(function* testInstalled() {
   for (let addon of gMockAddons) {
     gPrefs.setIntPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_LAST_UPDATE, addon.id),
                       TEST_DATE.getTime());
     gPrefs.setBoolPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_AUTOUPDATE, addon.id), false);
     gPrefs.setCharPref(getKey(GMPScope.GMPPrefs.KEY_PLUGIN_VERSION, addon.id), "1.2.3.4");
 
-    yield gCategoryUtilities.openType("plugin");
-
     let item = get_addon_element(gManagerWindow, addon.id);
     Assert.ok(item, "Got add-on element.");
     item.parentNode.ensureElementIsVisible(item);
     is(item.getAttribute("active"), "true");
 
     let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning");
     is_element_hidden(el, "Warning notification is hidden.");
     el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
@@ -264,24 +267,24 @@ add_task(function* testInstalledDetails(
     contextMenu.addEventListener("popupshown", listener, false);
     el = doc.getElementsByClassName("detail-view-container")[0];
     EventUtils.synthesizeMouse(el, 4, 4, { }, gManagerWindow);
     EventUtils.synthesizeMouse(el, 4, 4, { type: "contextmenu", button: 2 }, gManagerWindow);
     yield deferred.promise;
     let menuSep = doc.getElementById("addonitem-menuseparator");
     is_element_hidden(menuSep, "Menu separator is hidden.");
     contextMenu.hidePopup();
+
+    yield gCategoryUtilities.openType("plugin");
   }
 });
 
 add_task(function* testInstalledGlobalEmeDisabled() {
   gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, false);
   for (let addon of gMockAddons) {
-    yield gCategoryUtilities.openType("plugin");
-
     let item = get_addon_element(gManagerWindow, addon.id);
     if (addon.isEME) {
       Assert.ok(!item, "Couldn't get add-on element.");
     } else {
       Assert.ok(item, "Got add-on element.");
     }
   }
   gPrefs.setBoolPref(GMPScope.GMPPrefs.KEY_EME_ENABLED, true);