Bug 1268619 - Add a mozscreenshots configuration for site permission notifications. r=MattN
authorJohann Hofmann <jhofmann@mozilla.com>
Thu, 26 May 2016 16:23:14 -0700
changeset 340300 32a5b0f3bf99fd10d0849a4d17927d3179cd9ed6
parent 340127 34ac60e5b29c55eba69ab7e769dbc3b2eb7d5321
child 340301 ee1f0ff9a75046c25258a979fefe1fc4c039591b
push id1183
push userraliiev@mozilla.com
push dateMon, 05 Sep 2016 20:01:49 +0000
treeherdermozilla-release@3148731bed45 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1268619
milestone49.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 1268619 - Add a mozscreenshots configuration for site permission notifications. r=MattN MozReview-Commit-ID: 8mryMwYOxxn
browser/tools/mozscreenshots/browser.ini
browser/tools/mozscreenshots/moz.build
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PermissionPrompts.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/lib/borderify.xpi
browser/tools/mozscreenshots/mozscreenshots/extension/lib/permissionPrompts.html
browser/tools/mozscreenshots/permissionPrompts/browser.ini
browser/tools/mozscreenshots/permissionPrompts/browser_permissionPrompts.js
--- a/browser/tools/mozscreenshots/browser.ini
+++ b/browser/tools/mozscreenshots/browser.ini
@@ -1,6 +1,8 @@
 [DEFAULT]
 subsuite = screenshots
 support-files =
   head.js
+  mozscreenshots/extension/lib/permissionPrompts.html
+  mozscreenshots/extension/lib/borderify.xpi
 
 [browser_screenshots.js]
--- a/browser/tools/mozscreenshots/moz.build
+++ b/browser/tools/mozscreenshots/moz.build
@@ -4,15 +4,16 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 BROWSER_CHROME_MANIFESTS += [
     # Each test is in it's own directory so it gets run in a clean profile with
     # run-by-dir.
     'browser.ini',
     'devtools/browser.ini',
+    'permissionPrompts/browser.ini',
     'preferences/browser.ini',
     'primaryUI/browser.ini',
 ]
 
 TEST_DIRS += [
     'mozscreenshots/extension',
 ]
new file mode 100644
--- /dev/null
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PermissionPrompts.jsm
@@ -0,0 +1,130 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+this.EXPORTED_SYMBOLS = ["PermissionPrompts"];
+
+const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
+
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/Task.jsm");
+Cu.import("resource:///modules/E10SUtils.jsm");
+Cu.import("resource://testing-common/ContentTask.jsm");
+Cu.import("resource://testing-common/BrowserTestUtils.jsm");
+
+const URL = "https://test1.example.com/extensions/mozscreenshots/browser/chrome/mozscreenshots/lib/permissionPrompts.html";
+let lastTab = null;
+
+this.PermissionPrompts = {
+  init(libDir) {
+    Services.prefs.setBoolPref("media.navigator.permission.fake", true);
+    Services.prefs.setCharPref("media.getusermedia.screensharing.allowed_domains",
+                               "test1.example.com");
+    Services.prefs.setBoolPref("extensions.install.requireBuiltInCerts", false);
+  },
+
+  configurations: {
+    shareDevices: {
+      applyConfig: Task.async(function*() {
+        yield closeLastTab();
+        yield clickOn("#webRTC-shareDevices");
+      }),
+    },
+
+    shareMicrophone: {
+      applyConfig: Task.async(function*() {
+        yield closeLastTab();
+        yield clickOn("#webRTC-shareMicrophone");
+      }),
+    },
+
+    shareVideoAndMicrophone: {
+      applyConfig: Task.async(function*() {
+        yield closeLastTab();
+        yield clickOn("#webRTC-shareDevices2");
+      }),
+    },
+
+    shareScreen: {
+      applyConfig: Task.async(function*() {
+        yield closeLastTab();
+        yield clickOn("#webRTC-shareScreen");
+      }),
+    },
+
+    geo: {
+      applyConfig: Task.async(function*() {
+        yield closeLastTab();
+        yield clickOn("#geo");
+      }),
+    },
+
+    loginCapture: {
+      applyConfig: Task.async(function*() {
+        yield closeLastTab();
+        yield clickOn("#login-capture", URL);
+      }),
+    },
+
+    notifications: {
+      applyConfig: Task.async(function*() {
+        yield closeLastTab();
+        yield clickOn("#web-notifications", URL);
+      }),
+    },
+
+    addons: {
+      applyConfig: Task.async(function*() {
+        Services.prefs.setBoolPref("xpinstall.whitelist.required", true);
+
+        yield closeLastTab();
+        yield clickOn("#addons", URL);
+      }),
+    },
+
+    addonsNoWhitelist: {
+      applyConfig: Task.async(function*() {
+        Services.prefs.setBoolPref("xpinstall.whitelist.required", false);
+
+        let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
+        let notification = browserWindow.document.getElementById("addon-install-confirmation-notification");
+
+        yield closeLastTab();
+        yield clickOn("#addons", URL);
+
+        // We want to skip the progress-notification, so we wait for
+        // the install-confirmation screen to be "not hidden" = shown.
+        yield BrowserTestUtils.waitForCondition(() => !notification.hasAttribute("hidden"),
+                                                "addon install confirmation did not show", 200);
+      }),
+    },
+  },
+};
+
+function* closeLastTab(selector) {
+  if (!lastTab) {
+    return;
+  }
+  let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
+  yield BrowserTestUtils.removeTab(lastTab);
+  lastTab = null;
+}
+
+function* clickOn(selector) {
+  let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
+
+  // Save the tab so we can close it later.
+  lastTab = yield BrowserTestUtils.openNewForegroundTab(browserWindow.gBrowser, URL);
+
+  yield ContentTask.spawn(lastTab.linkedBrowser, selector, function* (arg) {
+    E10SUtils.wrapHandlingUserInput(content, true, function() {
+      let element = content.document.querySelector(arg);
+      element.click();
+    });
+  });
+
+  // Wait for the popup to actually be shown before making the screenshot
+  yield BrowserTestUtils.waitForEvent(browserWindow.PopupNotifications.panel, "popupshown");
+}
new file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..66ae92ed21152aa799d6d0a273bae874ecb4438f
GIT binary patch
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Fgj>i4k>B46tX8$xizE*WxHb=gK%h|eh8zP>B>A(2*r|s%4
z?pK)^|F#vanNzcp>lAyQNwwSQb#B{V_vc9SMm_t^7v<OL*O#=xOzp1cC(k4L6Fpkr
zJySWK5D@tNOUyT+jc?b<xcMIcuztR7)pmF0`2`Eq?{#lgEWEQKV5<H-K9k8d$;)+w
zqrcY8I*jJs{vDTI-v;s?0<kbW@*t^4*Th1vATRwj&xhjYPbWP}N=SI{^-BRK(<L^A
zGY8pJ4$rLH#;iFlN&UP4pTdfV9xoX_S#sMbbxTU@Xmy-1G4YxV=YoXI%e#|3+#cUv
z-B-iQ#dJ<wKkU!-x?2AQsjVMx)!**l^l9Cj)Qk_G>gGM(|NBKx`o`<`U2cCdin)7j
zW_;}GnSbVYrncUEdTh?~O`dPG%x^N^lil&*-LX2hW1+L2@@|qAdLmn9v_CW9@7V$`
zv&PuxYytBQT0LBFw{d5UVg2;`+h4zbaR2au6CWPf-CtGKH^YC{zR3;e5<irDEslIX
z<pK*ZAu}?GFyJoQAV2_0!wNc>9_&RO0;r%DeCS%yGc5v4Wkk)w=sMB!90CY1q2)ky
pt>_6H0q!v&C3kdf=m`Y@&N5?7HUZwOY>;qdV~7FTb(00e0{{{5ZKMDI
new file mode 100644
--- /dev/null
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/lib/permissionPrompts.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Permission Prompts</title>
+</head>
+<body>
+  <button id="geo" onclick="navigator.geolocation.getCurrentPosition(() => {})">Geolocation</button>
+  <button id="webRTC-shareDevices" onclick="shareDevice({video: true, fake: true});">Video</button>
+  <button id="webRTC-shareMicrophone" onclick="shareDevice({audio: true, fake: true});">Audio</button>
+  <button id="webRTC-shareDevices2" onclick="shareDevice({audio: true, video: true, fake: true});">Audio and Video</button>
+  <button id="webRTC-shareScreen" onclick="shareDevice({video: {mediaSource: 'screen'}});">Screen</button>
+  <button id="web-notifications" onclick="Notification.requestPermission()">web-notifications</button>
+  <a id="addons" href="borderify.xpi">Install Add-On</a>
+  <form>
+    <input type="email" id="email" value="email@example.com" />
+    <input type="password" id="password" value="123456" />
+    <button type="submit" id="login-capture">Login</button>
+  </form>
+
+  <script type="application/javascript">
+    function shareDevice(config) {
+      navigator.mediaDevices.getUserMedia(config);
+    }
+  </script>
+
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/browser/tools/mozscreenshots/permissionPrompts/browser.ini
@@ -0,0 +1,6 @@
+[DEFAULT]
+subsuite = screenshots
+support-files =
+  ../head.js
+
+[browser_permissionPrompts.js]
new file mode 100644
--- /dev/null
+++ b/browser/tools/mozscreenshots/permissionPrompts/browser_permissionPrompts.js
@@ -0,0 +1,14 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+add_task(function* capture() {
+  if (!shouldCapture()) {
+    return;
+  }
+  let sets = ["LightweightThemes", "PermissionPrompts"];
+
+  yield TestRunner.start(sets);
+});