Bug 1513681 - part6 : modify test. r=daleharvey
authorAlastor Wu <alwu@mozilla.com>
Fri, 04 Jan 2019 18:23:22 +0000
changeset 509729 fedf648d3785496798d361b31c9bdd144e2b5897
parent 509728 86afca3f41ac522e120c22cc1b4c55ab86c83fe5
child 509730 4a1af6e7446a70f3e9b36541c317054bfab692f7
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdaleharvey
bugs1513681
milestone66.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 1513681 - part6 : modify test. r=daleharvey To check icon after tab receives `GloballyAutoplayBlocked` event. Differential Revision: https://phabricator.services.mozilla.com/D15533
browser/base/content/test/permissions/browser_autoplay_blocked.js
--- a/browser/base/content/test/permissions/browser_autoplay_blocked.js
+++ b/browser/base/content/test/permissions/browser_autoplay_blocked.js
@@ -33,20 +33,24 @@ add_task(async function testMainViewVisi
 
     await openIdentityPopup();
     ok(!BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is empty");
     await closeIdentityPopup();
   });
 
   Services.prefs.setIntPref("media.autoplay.default", Ci.nsIAutoplay.BLOCKED);
 
-  await BrowserTestUtils.withNewTab(AUTOPLAY_PAGE, async function() {
+  await BrowserTestUtils.withNewTab(AUTOPLAY_PAGE, async function(browser) {
     let permissionsList = document.getElementById("identity-popup-permission-list");
     let emptyLabel = permissionsList.nextElementSibling.nextElementSibling;
 
+    if (BrowserTestUtils.is_hidden(autoplayBlockedIcon())) {
+      // The block icon would be showed after tab receives `GloballyAutoplayBlocked` event.
+      await BrowserTestUtils.waitForEvent(browser, "GloballyAutoplayBlocked");
+    }
     ok(!BrowserTestUtils.is_hidden(autoplayBlockedIcon()), "Blocked icon is shown");
 
     await openIdentityPopup();
     ok(BrowserTestUtils.is_hidden(emptyLabel), "List of permissions is not empty");
     let labelText = SitePermissions.getPermissionLabel("autoplay-media");
     let labels = permissionsList.querySelectorAll(".identity-popup-permission-label");
     is(labels.length, 1, "One permission visible in main view");
     is(labels[0].textContent, labelText, "Correct value");