mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1268648 - Add a mozscreenshots configuration for control center. r=MattN
MozReview-Commit-ID: 1RkPqLRPUgT --HG-- extra : rebase_source : c06364c85e1520c4516e25829a0ff7c09a87b53c
This commit is contained in:
parent
f18b35ca6f
commit
b3d4a2a542
@ -3,6 +3,10 @@ subsuite = screenshots
|
||||
support-files =
|
||||
head.js
|
||||
mozscreenshots/extension/lib/permissionPrompts.html
|
||||
mozscreenshots/extension/lib/controlCenter/password.html
|
||||
mozscreenshots/extension/lib/controlCenter/mixed.html
|
||||
mozscreenshots/extension/lib/controlCenter/mixed_active.html
|
||||
mozscreenshots/extension/lib/controlCenter/mixed_passive.html
|
||||
mozscreenshots/extension/lib/borderify.xpi
|
||||
|
||||
[browser_screenshots.js]
|
||||
|
6
browser/tools/mozscreenshots/controlCenter/browser.ini
Normal file
6
browser/tools/mozscreenshots/controlCenter/browser.ini
Normal file
@ -0,0 +1,6 @@
|
||||
[DEFAULT]
|
||||
subsuite = screenshots
|
||||
support-files =
|
||||
../head.js
|
||||
|
||||
[browser_controlCenter.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", "ControlCenter"];
|
||||
|
||||
yield TestRunner.start(sets, "controlCenter");
|
||||
});
|
@ -8,6 +8,7 @@ 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',
|
||||
'controlCenter/browser.ini',
|
||||
'devtools/browser.ini',
|
||||
'permissionPrompts/browser.ini',
|
||||
'preferences/browser.ini',
|
||||
|
@ -0,0 +1,238 @@
|
||||
/* 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 = ["ControlCenter"];
|
||||
|
||||
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://gre/modules/Timer.jsm");
|
||||
Cu.import("resource://testing-common/BrowserTestUtils.jsm");
|
||||
Cu.import("resource:///modules/SitePermissions.jsm");
|
||||
|
||||
let {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
||||
|
||||
const RESOURCE_PATH = "extensions/mozscreenshots/browser/chrome/mozscreenshots/lib/controlCenter";
|
||||
const HTTP_PAGE = "http://example.com/";
|
||||
const HTTPS_PAGE = "https://example.com/";
|
||||
const PERMISSIONS_PAGE = "https://test1.example.com/";
|
||||
const HTTP_PASSWORD_PAGE = `http://test2.example.org/${RESOURCE_PATH}/password.html`;
|
||||
const MIXED_CONTENT_URL = `https://example.com/${RESOURCE_PATH}/mixed.html`;
|
||||
const MIXED_ACTIVE_CONTENT_URL = `https://example.com/${RESOURCE_PATH}/mixed_active.html`;
|
||||
const MIXED_PASSIVE_CONTENT_URL = `https://example.com/${RESOURCE_PATH}/mixed_passive.html`;
|
||||
const TRACKING_PAGE = `http://tracking.example.org/${RESOURCE_PATH}/tracking.html`;
|
||||
|
||||
this.ControlCenter = {
|
||||
init(libDir) { },
|
||||
|
||||
configurations: {
|
||||
about: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage("about:home");
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
localFile: {
|
||||
applyConfig: Task.async(function* () {
|
||||
let filePath = "file:///";
|
||||
if (Services.appinfo.OS === "WINNT") {
|
||||
filePath += "C:/";
|
||||
}
|
||||
yield loadPage(filePath);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
http: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(HTTP_PAGE);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
httpSubView: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(HTTP_PAGE);
|
||||
yield openIdentityPopup(true);
|
||||
}),
|
||||
},
|
||||
|
||||
https: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(HTTPS_PAGE);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
httpsSubView: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(HTTPS_PAGE);
|
||||
yield openIdentityPopup(true);
|
||||
}),
|
||||
},
|
||||
|
||||
singlePermission: {
|
||||
applyConfig: Task.async(function* () {
|
||||
let uri = Services.io.newURI(PERMISSIONS_PAGE, null, null)
|
||||
SitePermissions.set(uri, "camera", SitePermissions.ALLOW);
|
||||
|
||||
yield loadPage(PERMISSIONS_PAGE);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
allPermissions: {
|
||||
applyConfig: Task.async(function* () {
|
||||
// there are 3 possible non-default permission states, so we alternate between them
|
||||
let states = [SitePermissions.ALLOW, SitePermissions.BLOCK, SitePermissions.SESSION];
|
||||
let uri = Services.io.newURI(PERMISSIONS_PAGE, null, null)
|
||||
SitePermissions.listPermissions().forEach(function (permission, index) {
|
||||
SitePermissions.set(uri, permission, states[index % 3]);
|
||||
});
|
||||
|
||||
yield loadPage(PERMISSIONS_PAGE);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
mixed: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(MIXED_CONTENT_URL);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
mixedSubView: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(MIXED_CONTENT_URL);
|
||||
yield openIdentityPopup(true);
|
||||
}),
|
||||
},
|
||||
|
||||
mixedPassive: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(MIXED_PASSIVE_CONTENT_URL);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
mixedPassiveSubView: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(MIXED_PASSIVE_CONTENT_URL);
|
||||
yield openIdentityPopup(true);
|
||||
}),
|
||||
},
|
||||
|
||||
mixedActive: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(MIXED_ACTIVE_CONTENT_URL);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
mixedActiveSubView: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(MIXED_ACTIVE_CONTENT_URL);
|
||||
yield openIdentityPopup(true);
|
||||
}),
|
||||
},
|
||||
|
||||
mixedActiveUnblocked: {
|
||||
applyConfig: Task.async(function* () {
|
||||
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let gBrowser = browserWindow.gBrowser;
|
||||
yield loadPage(MIXED_ACTIVE_CONTENT_URL);
|
||||
gBrowser.ownerGlobal.gIdentityHandler.disableMixedContentProtection();
|
||||
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, MIXED_ACTIVE_CONTENT_URL);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
mixedActiveUnblockedSubView: {
|
||||
applyConfig: Task.async(function* () {
|
||||
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let gBrowser = browserWindow.gBrowser;
|
||||
yield loadPage(MIXED_ACTIVE_CONTENT_URL);
|
||||
gBrowser.ownerGlobal.gIdentityHandler.disableMixedContentProtection();
|
||||
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, MIXED_ACTIVE_CONTENT_URL);
|
||||
yield openIdentityPopup(true);
|
||||
}),
|
||||
},
|
||||
|
||||
httpPassword: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(HTTP_PASSWORD_PAGE);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
httpPasswordSubView: {
|
||||
applyConfig: Task.async(function* () {
|
||||
yield loadPage(HTTP_PASSWORD_PAGE);
|
||||
yield openIdentityPopup(true);
|
||||
}),
|
||||
},
|
||||
|
||||
trackingProtectionNoElements: {
|
||||
applyConfig: Task.async(function* () {
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
|
||||
|
||||
yield loadPage(HTTP_PAGE);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
trackingProtectionEnabled: {
|
||||
applyConfig: Task.async(function* () {
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
|
||||
Services.prefs.setIntPref("privacy.trackingprotection.introCount", 20);
|
||||
yield UrlClassifierTestUtils.addTestTrackers();
|
||||
|
||||
yield loadPage(TRACKING_PAGE);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
|
||||
trackingProtectionDisabled: {
|
||||
applyConfig: Task.async(function* () {
|
||||
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let gBrowser = browserWindow.gBrowser;
|
||||
Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
|
||||
Services.prefs.setIntPref("privacy.trackingprotection.introCount", 20);
|
||||
yield UrlClassifierTestUtils.addTestTrackers();
|
||||
|
||||
yield loadPage(TRACKING_PAGE);
|
||||
yield openIdentityPopup();
|
||||
// unblock the page
|
||||
gBrowser.ownerGlobal.document.querySelector("#tracking-action-unblock").click();
|
||||
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, TRACKING_PAGE);
|
||||
yield openIdentityPopup();
|
||||
}),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
function* loadPage(url) {
|
||||
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let gBrowser = browserWindow.gBrowser;
|
||||
BrowserTestUtils.loadURI(gBrowser.selectedBrowser, url);
|
||||
yield BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, url);
|
||||
}
|
||||
|
||||
function* openIdentityPopup(expand) {
|
||||
let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
let gBrowser = browserWindow.gBrowser;
|
||||
let { gIdentityHandler } = gBrowser.ownerGlobal;
|
||||
gIdentityHandler._identityPopup.hidePopup();
|
||||
gIdentityHandler._identityBox.querySelector("#identity-icon").click();
|
||||
if (expand) {
|
||||
// give some time for opening to avoid weird style issues
|
||||
yield new Promise((c) => setTimeout(c, 500));
|
||||
gIdentityHandler._identityPopup.querySelector("#identity-popup-security-expander").click();
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<title>Mixed Content test</title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe style="visibility:hidden" src="http://example.com"></iframe>
|
||||
<img style="visibility:hidden" src="http://example.com/tests/image/test/mochitest/blue.png"></img>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<title>Mixed Active Content test</title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe style="visibility:hidden" src="http://example.com"></iframe>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<title>Mixed Passive Content test</title>
|
||||
</head>
|
||||
<body>
|
||||
<img style="visibility:hidden" src="http://example.com/tests/image/test/mochitest/blue.png"></img>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,13 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<title>HTTP Password test</title>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
<input type="password" />
|
||||
<button type="submit">Submit</button>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf8">
|
||||
<title>Tracking test</title>
|
||||
</head>
|
||||
<body>
|
||||
<iframe style="visibility:hidden" src="http://tracking.example.com/"></iframe>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user