Bug 1318690: Fix a minor test race. r=trivial
authorKris Maglione <maglione.k@gmail.com>
Fri, 18 Nov 2016 12:36:13 -0800
changeset 323477 febd601ee6075c906f6152bb61bcc3f75b4e92a7
parent 323476 5af0876208e024f55cbe1a57c59890f7eb102a02
child 323478 4fefdb64d28ff835ad24def74ec09f360a3263c0
push id30978
push usercbook@mozilla.com
push dateMon, 21 Nov 2016 14:44:46 +0000
treeherdermozilla-central@0534254e9a40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstrivial
bugs1318690
milestone53.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 1318690: Fix a minor test race. r=trivial MozReview-Commit-ID: 1GjJnUK1i7Z
browser/components/extensions/test/browser/browser_ext_browserAction_popup_preload.js
--- a/browser/components/extensions/test/browser/browser_ext_browserAction_popup_preload.js
+++ b/browser/components/extensions/test/browser/browser_ext_browserAction_popup_preload.js
@@ -82,37 +82,43 @@ add_task(function* testBrowserActionDisa
   let extension = ExtensionTestUtils.loadExtension({
     manifest: {
       "browser_action": {
         "default_popup": "popup.html",
         "browser_style": true,
       },
     },
 
-    background() {
-      browser.browserAction.disable();
+    background: async function() {
+      await browser.browserAction.disable();
+      browser.test.sendMessage("browserAction-disabled");
     },
 
     files: {
       "popup.html": `<!DOCTYPE html><html><head><meta charset="utf-8"><script src="popup.js"></script></head></html>`,
       "popup.js"() {
         browser.test.fail("Should not get here");
       },
     },
   });
 
   yield extension.startup();
 
+  yield extension.awaitMessage("browserAction-disabled");
+
   const {GlobalManager, Management: {global: {browserActionFor}}} = Cu.import("resource://gre/modules/Extension.jsm", {});
 
   let ext = GlobalManager.extensionMap.get(extension.id);
   let browserAction = browserActionFor(ext);
 
   let widget = getBrowserActionWidget(extension).forWindow(window);
 
+  is(widget.node.getAttribute("disabled"), "true", "Button is disabled");
+  is(browserAction.pendingPopup, null, "Have no pending popup prior to click");
+
   // Test canceled click.
   EventUtils.synthesizeMouseAtCenter(widget.node, {type: "mousedown", button: 0}, window);
 
   is(browserAction.pendingPopup, null, "Have no pending popup");
   is(browserAction.pendingPopupTimeout, null, "Have no pending popup timeout");
 
   EventUtils.synthesizeMouseAtCenter(document.documentElement, {type: "mouseup", button: 0}, window);