Bug 1331527 - Split up browser_temporary_permissions test to avoid timeouts. r=past
authorJohann Hofmann <jhofmann@mozilla.com>
Tue, 17 Jan 2017 11:19:46 +0100
changeset 374666 48c65e52aea5a9acc4d5239b0287255a80971727
parent 374665 8d4fe24cd6640b7dec7d8bebca1fc83f3260450c
child 374667 279ce8dbf8f645c853060cc98e3d4ee17bd5d60d
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspast
bugs1331527
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 1331527 - Split up browser_temporary_permissions test to avoid timeouts. r=past MozReview-Commit-ID: sNXVpcMaH9
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_temporary_permissions.js
browser/base/content/test/general/browser_temporary_permissions_tabs.js
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -420,16 +420,17 @@ support-files =
   close_beforeunload.html
 [browser_tabs_isActive.js]
 [browser_tabs_owner.js]
 [browser_temporary_permissions.js]
 support-files =
   permissions.html
   temporary_permissions_subframe.html
 [browser_temporary_permissions_navigation.js]
+[browser_temporary_permissions_tabs.js]
 [browser_testOpenNewRemoteTabsFromNonRemoteBrowsers.js]
 run-if = e10s
 [browser_trackingUI_1.js]
 tags = trackingprotection
 support-files =
   trackingPage.html
   benignPage.html
 [browser_trackingUI_2.js]
--- a/browser/base/content/test/general/browser_temporary_permissions.js
+++ b/browser/base/content/test/general/browser_temporary_permissions.js
@@ -26,77 +26,16 @@ add_task(function* testTempPermissionCha
     Assert.notEqual(geoIcon.boxObject.width, 0, "geo anchor should be visible");
 
     SitePermissions.remove(uri, id, browser);
 
     Assert.equal(geoIcon.boxObject.width, 0, "geo anchor should not be visible");
   });
 });
 
-// Test that temp permissions are persisted through moving tabs to new windows.
-add_task(function* testTempPermissionOnTabMove() {
-  let uri = NetUtil.newURI("https://example.com");
-  let id = "geo";
-
-  let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, uri.spec);
-
-  SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, tab.linkedBrowser);
-
-  Assert.deepEqual(SitePermissions.get(uri, id, tab.linkedBrowser), {
-    state: SitePermissions.BLOCK,
-    scope: SitePermissions.SCOPE_TEMPORARY,
-  });
-
-  let promiseWin = BrowserTestUtils.waitForNewWindow();
-  gBrowser.replaceTabWithWindow(tab);
-  let win = yield promiseWin;
-  tab = win.gBrowser.selectedTab;
-
-  Assert.deepEqual(SitePermissions.get(uri, id, tab.linkedBrowser), {
-    state: SitePermissions.BLOCK,
-    scope: SitePermissions.SCOPE_TEMPORARY,
-  });
-
-  SitePermissions.remove(uri, id, tab.linkedBrowser);
-  yield BrowserTestUtils.closeWindow(win);
-});
-
-// Test that temp permissions don't affect other tabs of the same URI.
-add_task(function* testTempPermissionMultipleTabs() {
-  let uri = NetUtil.newURI("https://example.com");
-  let id = "geo";
-
-  let tab1 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, uri.spec);
-  let tab2 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, uri.spec);
-
-  SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, tab2.linkedBrowser);
-
-  Assert.deepEqual(SitePermissions.get(uri, id, tab2.linkedBrowser), {
-    state: SitePermissions.BLOCK,
-    scope: SitePermissions.SCOPE_TEMPORARY,
-  });
-
-  Assert.deepEqual(SitePermissions.get(uri, id, tab1.linkedBrowser), {
-    state: SitePermissions.UNKNOWN,
-    scope: SitePermissions.SCOPE_PERSISTENT,
-  });
-
-  let geoIcon = document.querySelector(".blocked-permission-icon[data-permission-id=geo]");
-
-  Assert.notEqual(geoIcon.boxObject.width, 0, "geo anchor should be visible");
-
-  yield BrowserTestUtils.switchTab(gBrowser, tab1);
-
-  Assert.equal(geoIcon.boxObject.width, 0, "geo anchor should not be visible");
-
-  SitePermissions.remove(uri, id, tab2.linkedBrowser);
-  yield BrowserTestUtils.removeTab(tab1);
-  yield BrowserTestUtils.removeTab(tab2);
-});
-
 // Test that temp blocked permissions requested by subframes (with a different URI) affect the whole page.
 add_task(function* testTempPermissionSubframes() {
   let uri = NetUtil.newURI("https://example.com");
   let id = "geo";
 
   yield BrowserTestUtils.withNewTab(SUBFRAME_PAGE, function*(browser) {
     let popupshown = BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown");
 
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/general/browser_temporary_permissions_tabs.js
@@ -0,0 +1,68 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+Cu.import("resource:///modules/SitePermissions.jsm", this);
+
+// Test that temp permissions are persisted through moving tabs to new windows.
+add_task(function* testTempPermissionOnTabMove() {
+  let uri = NetUtil.newURI("https://example.com");
+  let id = "geo";
+
+  let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, uri.spec);
+
+  SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, tab.linkedBrowser);
+
+  Assert.deepEqual(SitePermissions.get(uri, id, tab.linkedBrowser), {
+    state: SitePermissions.BLOCK,
+    scope: SitePermissions.SCOPE_TEMPORARY,
+  });
+
+  let promiseWin = BrowserTestUtils.waitForNewWindow();
+  gBrowser.replaceTabWithWindow(tab);
+  let win = yield promiseWin;
+  tab = win.gBrowser.selectedTab;
+
+  Assert.deepEqual(SitePermissions.get(uri, id, tab.linkedBrowser), {
+    state: SitePermissions.BLOCK,
+    scope: SitePermissions.SCOPE_TEMPORARY,
+  });
+
+  SitePermissions.remove(uri, id, tab.linkedBrowser);
+  yield BrowserTestUtils.closeWindow(win);
+});
+
+// Test that temp permissions don't affect other tabs of the same URI.
+add_task(function* testTempPermissionMultipleTabs() {
+  let uri = NetUtil.newURI("https://example.com");
+  let id = "geo";
+
+  let tab1 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, uri.spec);
+  let tab2 = yield BrowserTestUtils.openNewForegroundTab(gBrowser, uri.spec);
+
+  SitePermissions.set(uri, id, SitePermissions.BLOCK, SitePermissions.SCOPE_TEMPORARY, tab2.linkedBrowser);
+
+  Assert.deepEqual(SitePermissions.get(uri, id, tab2.linkedBrowser), {
+    state: SitePermissions.BLOCK,
+    scope: SitePermissions.SCOPE_TEMPORARY,
+  });
+
+  Assert.deepEqual(SitePermissions.get(uri, id, tab1.linkedBrowser), {
+    state: SitePermissions.UNKNOWN,
+    scope: SitePermissions.SCOPE_PERSISTENT,
+  });
+
+  let geoIcon = document.querySelector(".blocked-permission-icon[data-permission-id=geo]");
+
+  Assert.notEqual(geoIcon.boxObject.width, 0, "geo anchor should be visible");
+
+  yield BrowserTestUtils.switchTab(gBrowser, tab1);
+
+  Assert.equal(geoIcon.boxObject.width, 0, "geo anchor should not be visible");
+
+  SitePermissions.remove(uri, id, tab2.linkedBrowser);
+  yield BrowserTestUtils.removeTab(tab1);
+  yield BrowserTestUtils.removeTab(tab2);
+});
+