Bug 1531838 - Reliably wait for click-to-play popup notification in private windows. r=johannh
authorNihanth Subramanya <nhnt11@gmail.com>
Sun, 14 Apr 2019 17:48:23 +0000
changeset 469654 d6e09cefb3c7
parent 469653 9f7b63f61c83
child 469655 2058918f63f0
push id35878
push userapavel@mozilla.com
push dateTue, 16 Apr 2019 15:43:40 +0000
treeherdermozilla-central@258af4e91151 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1531838
milestone68.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 1531838 - Reliably wait for click-to-play popup notification in private windows. r=johannh Differential Revision: https://phabricator.services.mozilla.com/D26700
browser/base/content/test/plugins/browser_private_clicktoplay.js
--- a/browser/base/content/test/plugins/browser_private_clicktoplay.js
+++ b/browser/base/content/test/plugins/browser_private_clicktoplay.js
@@ -105,17 +105,19 @@ add_task(async function test2a() {
   });
 });
 
 add_task(async function test2c() {
   let topicObserved = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
   await createPrivateWindow(gHttpTestRoot + "plugin_test.html");
   await topicObserved;
 
-  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
+  let popupNotification = await TestUtils.waitForCondition(() => {
+    return gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
+  }, "Waiting for click-to-play-plugins notification in the private window");
   ok(popupNotification, "Test 2c, Should have a click-to-play notification");
 
   await ContentTask.spawn(gPrivateBrowser, null, function() {
     let plugin = content.document.getElementById("test");
     let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
     ok(objLoadingContent.activated, "Test 2c, Plugin should be activated");
   });
 
@@ -167,17 +169,19 @@ add_task(async function test3a() {
   });
 });
 
 add_task(async function test3c() {
   let topicObserved = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
   await createPrivateWindow(gHttpTestRoot + "plugin_test.html");
   await topicObserved;
 
-  let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
+  let popupNotification = await TestUtils.waitForCondition(() => {
+    return gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
+  }, "Waiting for click-to-play-plugins notification in the private window");
   ok(popupNotification, "Test 3c, Should have a click-to-play notification");
 
   // Check the button status
   let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
                                                    "Shown");
   popupNotification.reshow();
   await promiseShown;
   is(gPrivateWindow.PopupNotifications.panel.firstElementChild.secondaryButton.hidden, true,