Bug 1381706 - Don't wait for XBL construction in the handler applications list tests. r=bgrins
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Wed, 18 Jul 2018 13:51:57 +0100
changeset 427162 f1aadf806cfdd0b77c545b4ac60c8f079ac83acd
parent 427161 b28ca0001c8e7f30a65cb18e65f750e460a68580
child 427163 4d96a7724d63ea7a5804081ad45ea3a569b556c1
push id34295
push usershindli@mozilla.com
push dateWed, 18 Jul 2018 21:45:46 +0000
treeherdermozilla-central@5a8107262015 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgrins
bugs1381706
milestone63.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 1381706 - Don't wait for XBL construction in the handler applications list tests. r=bgrins MozReview-Commit-ID: GL2SruwqBDs
browser/components/preferences/in-content/tests/browser.ini
browser/components/preferences/in-content/tests/browser_applications_selection.js
browser/components/preferences/in-content/tests/browser_change_app_handler.js
--- a/browser/components/preferences/in-content/tests/browser.ini
+++ b/browser/components/preferences/in-content/tests/browser.ini
@@ -4,17 +4,16 @@ prefs =
   extensions.formautofill.creditCards.available=true
 support-files =
   head.js
   privacypane_tests_perwindow.js
   addons/set_homepage.xpi
   addons/set_newtab.xpi
 
 [browser_applications_selection.js]
-skip-if = os == 'linux' || verify # bug 1382057
 [browser_advanced_update.js]
 skip-if = !updater
 [browser_basic_rebuild_fonts_test.js]
 [browser_bug410900.js]
 [browser_bug731866.js]
 [browser_search_no_results_change_category.js]
 [browser_search_within_preferences_1.js]
 [browser_search_within_preferences_2.js]
@@ -31,19 +30,17 @@ skip-if = !updater
 [browser_bug795764_cachedisabled.js]
 [browser_bug1018066_resetScrollPosition.js]
 [browser_bug1020245_openPreferences_to_paneContent.js]
 [browser_bug1184989_prevent_scrolling_when_preferences_flipped.js]
 [browser_engines.js]
 support-files =
   browser_bug1184989_prevent_scrolling_when_preferences_flipped.xul
 [browser_change_app_handler.js]
-skip-if = os != "win" || (os == "win" && os_version == "6.1") || (verify && debug)
-# This test tests the windows-specific app selection dialog, so can't run on non-Windows.
-# Skip the test on Window 7, see the detail at Bug 1381706.
+skip-if = os != "win" # Windows-specific handler application selection dialog
 [browser_checkspelling.js]
 [browser_connection.js]
 [browser_connection_bug388287.js]
 [browser_connection_bug1445991.js]
 skip-if = (verify && debug && (os == 'linux' || os == 'mac'))
 [browser_cookies_exceptions.js]
 [browser_defaultbrowser_alwayscheck.js]
 [browser_healthreport.js]
--- a/browser/components/preferences/in-content/tests/browser_applications_selection.js
+++ b/browser/components/preferences/in-content/tests/browser_applications_selection.js
@@ -25,59 +25,46 @@ add_task(async function getFeedItem() {
 });
 
 add_task(async function selectInternalOptionForFeed() {
   // Select the item.
   feedItem.scrollIntoView();
   container.selectItem(feedItem);
   Assert.ok(feedItem.selected, "Should be able to select our item.");
 
-  // Wait for the menu.
-  let list = await TestUtils.waitForCondition(() =>
-    win.document.getAnonymousElementByAttribute(feedItem, "class", "actionsMenu"));
-  info("Got list after item was selected");
+  let list = feedItem.querySelector(".actionsMenu");
 
   // Find the "Add Live bookmarks option".
   let chooseItems = list.getElementsByAttribute("action", Ci.nsIHandlerInfo.handleInternally);
   Assert.equal(chooseItems.length, 1, "Should only be one action to handle internally");
 
   // Select the option.
   let cmdEvent = win.document.createEvent("xulcommandevent");
   cmdEvent.initCommandEvent("command", true, true, win, 0, false, false, false, false, null, 0);
   chooseItems[0].dispatchEvent(cmdEvent);
 
   // Check that we display the correct result.
-  list = await TestUtils.waitForCondition(() =>
-    win.document.getAnonymousElementByAttribute(feedItem, "class", "actionsMenu"));
-  info("Got list after item was selected");
   Assert.ok(list.selectedItem, "Should have a selected item.");
   Assert.equal(list.selectedItem.getAttribute("action"),
                Ci.nsIHandlerInfo.handleInternally,
                "Newly selected item should be the expected one.");
 });
 
 // This builds on the previous selectInternalOptionForFeed task.
 add_task(async function reselectInternalOptionForFeed() {
   // Now select a different option in the list - use the pdf item as that doesn't
   // need to load any favicons.
   let anotherItem = container.querySelector("richlistitem[type='application/pdf']");
 
   container.selectItem(anotherItem);
 
-  // Wait for the menu so that we don't hit race conditions.
-  await TestUtils.waitForCondition(() =>
-    win.document.getAnonymousElementByAttribute(anotherItem, "class", "actionsMenu"));
-  info("Got list after item was selected");
-
   // Now select the feed item again, and check what it is displaying.
   container.selectItem(feedItem);
 
-  let list = await TestUtils.waitForCondition(() =>
-    win.document.getAnonymousElementByAttribute(feedItem, "class", "actionsMenu"));
-  info("Got list after item was selected");
+  let list = feedItem.querySelector(".actionsMenu");
 
   Assert.ok(list.selectedItem,
             "Should have a selected item");
   Assert.equal(list.selectedItem.getAttribute("action"),
                Ci.nsIHandlerInfo.handleInternally,
                "Selected item should still be the same as the previously selected item.");
 });
 
@@ -113,16 +100,20 @@ add_task(async function sortingCheck() {
   assertSortByAction("ascending");
   Assert.notEqual(oldActionDir,
                actionColumn.getAttribute("sortDirection"),
                "Sort direction should change");
 
   actionColumn.click();
   assertSortByAction("descending");
 
+  // Restore the default sort order
+  typeColumn.click();
+  assertSortByType("ascending");
+
   function assertSortByAction(order) {
   Assert.equal(actionColumn.getAttribute("sortDirection"),
                order,
                `Sort direction should be ${order}`);
     let siteItems = handlerView.getElementsByTagName("richlistitem");
     for (let i = 0; i < siteItems.length - 1; ++i) {
       let aType = siteItems[i].getAttribute("actionDescription").toLowerCase();
       let bType = siteItems[i + 1].getAttribute("actionDescription").toLowerCase();
--- a/browser/components/preferences/in-content/tests/browser_change_app_handler.js
+++ b/browser/components/preferences/in-content/tests/browser_change_app_handler.js
@@ -23,18 +23,17 @@ add_task(async function() {
 
   let container = win.document.getElementById("handlersView");
   let ourItem = container.querySelector("richlistitem[type='text/x-test-handler']");
   ok(ourItem, "handlersView is present");
   ourItem.scrollIntoView();
   container.selectItem(ourItem);
   ok(ourItem.selected, "Should be able to select our item.");
 
-  let list = await TestUtils.waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu"));
-  info("Got list after item was selected");
+  let list = ourItem.querySelector(".actionsMenu");
 
   let chooseItem = list.firstChild.querySelector(".choose-app-item");
   let dialogLoadedPromise = promiseLoadSubDialog("chrome://global/content/appPicker.xul");
   let cmdEvent = win.document.createEvent("xulcommandevent");
   cmdEvent.initCommandEvent("command", true, true, win, 0, false, false, false, false, null, 0);
   chooseItem.dispatchEvent(cmdEvent);
 
   let dialog = await dialogLoadedPromise;
@@ -46,18 +45,16 @@ add_task(async function() {
   let selectedApp = dialogList.firstChild.handlerApp;
   dialogDoc.documentElement.acceptDialog();
 
   // Verify results are correct in mime service:
   let mimeInfo = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null);
   ok(mimeInfo.preferredApplicationHandler.equals(selectedApp), "App should be set as preferred.");
 
   // Check that we display this result:
-  list = await TestUtils.waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu"));
-  info("Got list after item was selected");
   ok(list.selectedItem, "Should have a selected item");
   ok(mimeInfo.preferredApplicationHandler.equals(list.selectedItem.handlerApp),
      "App should be visible as preferred item.");
 
 
   // Now try to 'manage' this list:
   dialogLoadedPromise = promiseLoadSubDialog("chrome://browser/content/preferences/applicationManager.xul");
 
@@ -79,17 +76,16 @@ add_task(async function() {
   is(dialogList.children.length, itemsBefore - 1, "Item got removed");
   dialogDoc.documentElement.acceptDialog();
 
   // Verify results are correct in mime service:
   mimeInfo = gMimeSvc.getFromTypeAndExtension("text/x-test-handler", null);
   ok(!mimeInfo.preferredApplicationHandler, "App should no longer be set as preferred.");
 
   // Check that we display this result:
-  list = await TestUtils.waitForCondition(() => win.document.getAnonymousElementByAttribute(ourItem, "class", "actionsMenu"));
   ok(list.selectedItem, "Should have a selected item");
   ok(!list.selectedItem.handlerApp,
      "No app should be visible as preferred item.");
 
   BrowserTestUtils.removeTab(gBrowser.selectedTab);
 });
 
 registerCleanupFunction(function() {