mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1175858 - Style updates for browser tracking protection tests;r=MattN
This commit is contained in:
parent
ac1c9234ae
commit
64f58c9f56
@ -1,13 +1,11 @@
|
|||||||
/* 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
|
* Test that the Tracking Protection section is visible in the Control Center
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* and has the correct state for the cases when:
|
||||||
|
* 1) A page with no tracking elements is loaded.
|
||||||
// Test that the Tracking Protection section is visible in the Control Center
|
* 2) A page with tracking elements is loaded and they are blocked.
|
||||||
// and has the correct state for the cases when:
|
* 3) A page with tracking elements is loaded and they are not blocked.
|
||||||
// * A page with no tracking elements is loaded.
|
* See also Bugs 1175327, 1043801, 1178985
|
||||||
// * A page with tracking elements is loaded and they are blocked.
|
*/
|
||||||
// * A page with tracking elements is loaded and they are not blocked.
|
|
||||||
// See also Bugs 1175327, 1043801, 1178985
|
|
||||||
|
|
||||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||||
const PREF = "privacy.trackingprotection.enabled";
|
const PREF = "privacy.trackingprotection.enabled";
|
||||||
@ -15,12 +13,12 @@ const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
|||||||
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
||||||
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
||||||
let TrackingProtection = null;
|
let TrackingProtection = null;
|
||||||
let browser = null;
|
let tabbrowser = null;
|
||||||
|
|
||||||
let {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
let {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
||||||
|
|
||||||
registerCleanupFunction(function() {
|
registerCleanupFunction(function() {
|
||||||
TrackingProtection = browser = null;
|
TrackingProtection = tabbrowser = null;
|
||||||
UrlClassifierTestUtils.cleanupTestTrackers();
|
UrlClassifierTestUtils.cleanupTestTrackers();
|
||||||
Services.prefs.clearUserPref(PREF);
|
Services.prefs.clearUserPref(PREF);
|
||||||
Services.prefs.clearUserPref(PB_PREF);
|
Services.prefs.clearUserPref(PB_PREF);
|
||||||
@ -30,7 +28,7 @@ registerCleanupFunction(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function hidden(sel) {
|
function hidden(sel) {
|
||||||
let win = browser.ownerGlobal;
|
let win = tabbrowser.ownerGlobal;
|
||||||
let el = win.document.querySelector(sel);
|
let el = win.document.querySelector(sel);
|
||||||
let display = win.getComputedStyle(el).getPropertyValue("display", null);
|
let display = win.getComputedStyle(el).getPropertyValue("display", null);
|
||||||
let opacity = win.getComputedStyle(el).getPropertyValue("opacity", null);
|
let opacity = win.getComputedStyle(el).getPropertyValue("opacity", null);
|
||||||
@ -38,7 +36,7 @@ function hidden(sel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clickButton(sel) {
|
function clickButton(sel) {
|
||||||
let win = browser.ownerGlobal;
|
let win = tabbrowser.ownerGlobal;
|
||||||
let el = win.document.querySelector(sel);
|
let el = win.document.querySelector(sel);
|
||||||
el.doCommand();
|
el.doCommand();
|
||||||
}
|
}
|
||||||
@ -128,8 +126,8 @@ function* testTrackingProtectionForTab(tab) {
|
|||||||
add_task(function* testNormalBrowsing() {
|
add_task(function* testNormalBrowsing() {
|
||||||
yield UrlClassifierTestUtils.addTestTrackers();
|
yield UrlClassifierTestUtils.addTestTrackers();
|
||||||
|
|
||||||
browser = gBrowser;
|
tabbrowser = gBrowser;
|
||||||
let tab = browser.selectedTab = browser.addTab();
|
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
|
||||||
|
|
||||||
TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
|
TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
|
||||||
ok(TrackingProtection, "TP is attached to the browser window");
|
ok(TrackingProtection, "TP is attached to the browser window");
|
||||||
@ -147,10 +145,10 @@ add_task(function* testNormalBrowsing() {
|
|||||||
|
|
||||||
add_task(function* testPrivateBrowsing() {
|
add_task(function* testPrivateBrowsing() {
|
||||||
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
||||||
browser = privateWin.gBrowser;
|
tabbrowser = privateWin.gBrowser;
|
||||||
let tab = browser.selectedTab = browser.addTab();
|
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
|
||||||
|
|
||||||
TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
|
||||||
ok(TrackingProtection, "TP is attached to the private window");
|
ok(TrackingProtection, "TP is attached to the private window");
|
||||||
is(TrackingProtection.enabled, Services.prefs.getBoolPref(PB_PREF),
|
is(TrackingProtection.enabled, Services.prefs.getBoolPref(PB_PREF),
|
||||||
"TP.enabled is based on the pb pref value");
|
"TP.enabled is based on the pb pref value");
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* 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
|
* Test that the Tracking Protection section is never visible in the
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* Control Center when the feature is off.
|
||||||
|
* See also Bugs 1175327, 1043801, 1178985.
|
||||||
// Test that the Tracking Protection section is never visible in the
|
*/
|
||||||
// Control Center when the feature is off.
|
|
||||||
// See also Bugs 1175327, 1043801, 1178985.
|
|
||||||
|
|
||||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||||
const PREF = "privacy.trackingprotection.enabled";
|
const PREF = "privacy.trackingprotection.enabled";
|
||||||
@ -12,12 +10,12 @@ const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
|||||||
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
||||||
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
||||||
let TrackingProtection = null;
|
let TrackingProtection = null;
|
||||||
let browser = null;
|
let tabbrowser = null;
|
||||||
|
|
||||||
let {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
let {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
||||||
|
|
||||||
registerCleanupFunction(function() {
|
registerCleanupFunction(function() {
|
||||||
TrackingProtection = browser = null;
|
TrackingProtection = tabbrowser = null;
|
||||||
UrlClassifierTestUtils.cleanupTestTrackers();
|
UrlClassifierTestUtils.cleanupTestTrackers();
|
||||||
Services.prefs.clearUserPref(PREF);
|
Services.prefs.clearUserPref(PREF);
|
||||||
Services.prefs.clearUserPref(PB_PREF);
|
Services.prefs.clearUserPref(PB_PREF);
|
||||||
@ -29,10 +27,10 @@ registerCleanupFunction(function() {
|
|||||||
add_task(function* testNormalBrowsing() {
|
add_task(function* testNormalBrowsing() {
|
||||||
yield UrlClassifierTestUtils.addTestTrackers();
|
yield UrlClassifierTestUtils.addTestTrackers();
|
||||||
|
|
||||||
browser = gBrowser;
|
tabbrowser = gBrowser;
|
||||||
let tab = browser.selectedTab = browser.addTab();
|
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
|
||||||
|
|
||||||
TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
|
||||||
ok(TrackingProtection, "TP is attached to the browser window");
|
ok(TrackingProtection, "TP is attached to the browser window");
|
||||||
is(TrackingProtection.enabled, Services.prefs.getBoolPref(PREF),
|
is(TrackingProtection.enabled, Services.prefs.getBoolPref(PREF),
|
||||||
"TP.enabled is based on the original pref value");
|
"TP.enabled is based on the original pref value");
|
||||||
@ -54,10 +52,10 @@ add_task(function* testNormalBrowsing() {
|
|||||||
|
|
||||||
add_task(function* testPrivateBrowsing() {
|
add_task(function* testPrivateBrowsing() {
|
||||||
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
||||||
browser = privateWin.gBrowser;
|
tabbrowser = privateWin.gBrowser;
|
||||||
let tab = browser.selectedTab = browser.addTab();
|
let tab = tabbrowser.selectedTab = tabbrowser.addTab();
|
||||||
|
|
||||||
TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
|
||||||
ok(TrackingProtection, "TP is attached to the private window");
|
ok(TrackingProtection, "TP is attached to the private window");
|
||||||
is(TrackingProtection.enabled, Services.prefs.getBoolPref(PB_PREF),
|
is(TrackingProtection.enabled, Services.prefs.getBoolPref(PB_PREF),
|
||||||
"TP.enabled is based on the pb pref value");
|
"TP.enabled is based on the pb pref value");
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
/* 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
|
* Test that the Tracking Protection is correctly enabled / disabled
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* in both normal and private windows given all possible states of the prefs:
|
||||||
|
* privacy.trackingprotection.enabled
|
||||||
// Test that the Tracking Protection is correctly enabled / disabled
|
* privacy.trackingprotection.pbmode.enabled
|
||||||
// in both normal and private windows given all possible states of the prefs:
|
* See also Bug 1178985.
|
||||||
// privacy.trackingprotection.enabled
|
*/
|
||||||
// privacy.trackingprotection.pbmode.enabled
|
|
||||||
// See also Bug 1178985.
|
|
||||||
|
|
||||||
const PREF = "privacy.trackingprotection.enabled";
|
const PREF = "privacy.trackingprotection.enabled";
|
||||||
const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
||||||
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
|
||||||
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
|
||||||
|
|
||||||
registerCleanupFunction(function() {
|
registerCleanupFunction(function() {
|
||||||
Services.prefs.clearUserPref(PREF);
|
Services.prefs.clearUserPref(PREF);
|
||||||
@ -19,8 +15,7 @@ registerCleanupFunction(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
add_task(function* testNormalBrowsing() {
|
add_task(function* testNormalBrowsing() {
|
||||||
let browser = gBrowser;
|
let TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
|
||||||
let TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
|
||||||
ok(TrackingProtection, "TP is attached to the browser window");
|
ok(TrackingProtection, "TP is attached to the browser window");
|
||||||
|
|
||||||
Services.prefs.setBoolPref(PREF, true);
|
Services.prefs.setBoolPref(PREF, true);
|
||||||
@ -38,9 +33,7 @@ add_task(function* testNormalBrowsing() {
|
|||||||
|
|
||||||
add_task(function* testPrivateBrowsing() {
|
add_task(function* testPrivateBrowsing() {
|
||||||
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
||||||
let browser = privateWin.gBrowser;
|
let TrackingProtection = privateWin.gBrowser.ownerGlobal.TrackingProtection;
|
||||||
|
|
||||||
let TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
|
||||||
ok(TrackingProtection, "TP is attached to the browser window");
|
ok(TrackingProtection, "TP is attached to the browser window");
|
||||||
|
|
||||||
Services.prefs.setBoolPref(PREF, true);
|
Services.prefs.setBoolPref(PREF, true);
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
/* 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
|
* Test that the Tracking Protection icon is properly animated in the identity
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* block when loading tabs and switching between tabs.
|
||||||
|
* See also Bug 1175858.
|
||||||
// Test that the Tracking Protection icon is properly animated in the identity
|
*/
|
||||||
// block when loading tabs and switching between tabs.
|
|
||||||
// See also Bug 1175858.
|
|
||||||
|
|
||||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||||
const PREF = "privacy.trackingprotection.enabled";
|
const PREF = "privacy.trackingprotection.enabled";
|
||||||
@ -12,12 +10,12 @@ const PB_PREF = "privacy.trackingprotection.pbmode.enabled";
|
|||||||
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
const BENIGN_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/benignPage.html";
|
||||||
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
const TRACKING_PAGE = "http://tracking.example.org/browser/browser/base/content/test/general/trackingPage.html";
|
||||||
let TrackingProtection = null;
|
let TrackingProtection = null;
|
||||||
let browser = null;
|
let tabbrowser = null;
|
||||||
|
|
||||||
let {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
let {UrlClassifierTestUtils} = Cu.import("resource://testing-common/UrlClassifierTestUtils.jsm", {});
|
||||||
|
|
||||||
registerCleanupFunction(function() {
|
registerCleanupFunction(function() {
|
||||||
TrackingProtection = browser = null;
|
TrackingProtection = tabbrowser = null;
|
||||||
UrlClassifierTestUtils.cleanupTestTrackers();
|
UrlClassifierTestUtils.cleanupTestTrackers();
|
||||||
Services.prefs.clearUserPref(PREF);
|
Services.prefs.clearUserPref(PREF);
|
||||||
Services.prefs.clearUserPref(PB_PREF);
|
Services.prefs.clearUserPref(PB_PREF);
|
||||||
@ -34,31 +32,31 @@ function waitForSecurityChange(numChanges = 1) {
|
|||||||
n = n + 1;
|
n = n + 1;
|
||||||
info ("Recieved onSecurityChange event " + n + " of " + numChanges);
|
info ("Recieved onSecurityChange event " + n + " of " + numChanges);
|
||||||
if (n >= numChanges) {
|
if (n >= numChanges) {
|
||||||
browser.removeProgressListener(listener);
|
tabbrowser.removeProgressListener(listener);
|
||||||
resolve();
|
resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
browser.addProgressListener(listener);
|
tabbrowser.addProgressListener(listener);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function* testTrackingProtectionAnimation() {
|
function* testTrackingProtectionAnimation() {
|
||||||
info("Load a test page not containing tracking elements");
|
info("Load a test page not containing tracking elements");
|
||||||
let benignTab = yield BrowserTestUtils.openNewForegroundTab(browser, BENIGN_PAGE);
|
let benignTab = yield BrowserTestUtils.openNewForegroundTab(tabbrowser, BENIGN_PAGE);
|
||||||
|
|
||||||
ok(!TrackingProtection.icon.hasAttribute("state"), "icon: no state");
|
ok(!TrackingProtection.icon.hasAttribute("state"), "icon: no state");
|
||||||
ok(TrackingProtection.icon.hasAttribute("animate"), "icon: animate");
|
ok(TrackingProtection.icon.hasAttribute("animate"), "icon: animate");
|
||||||
|
|
||||||
info("Load a test page containing tracking elements");
|
info("Load a test page containing tracking elements");
|
||||||
let trackingTab = yield BrowserTestUtils.openNewForegroundTab(browser, TRACKING_PAGE);
|
let trackingTab = yield BrowserTestUtils.openNewForegroundTab(tabbrowser, TRACKING_PAGE);
|
||||||
|
|
||||||
ok(TrackingProtection.icon.hasAttribute("state"), "icon: state");
|
ok(TrackingProtection.icon.hasAttribute("state"), "icon: state");
|
||||||
ok(TrackingProtection.icon.hasAttribute("animate"), "icon: animate");
|
ok(TrackingProtection.icon.hasAttribute("animate"), "icon: animate");
|
||||||
|
|
||||||
info("Switch from tracking -> benign tab");
|
info("Switch from tracking -> benign tab");
|
||||||
let securityChanged = waitForSecurityChange();
|
let securityChanged = waitForSecurityChange();
|
||||||
browser.selectedTab = benignTab;
|
tabbrowser.selectedTab = benignTab;
|
||||||
yield securityChanged;
|
yield securityChanged;
|
||||||
|
|
||||||
ok(!TrackingProtection.icon.hasAttribute("state"), "icon: no state");
|
ok(!TrackingProtection.icon.hasAttribute("state"), "icon: no state");
|
||||||
@ -66,7 +64,7 @@ function* testTrackingProtectionAnimation() {
|
|||||||
|
|
||||||
info("Switch from benign -> tracking tab");
|
info("Switch from benign -> tracking tab");
|
||||||
securityChanged = waitForSecurityChange();
|
securityChanged = waitForSecurityChange();
|
||||||
browser.selectedTab = trackingTab;
|
tabbrowser.selectedTab = trackingTab;
|
||||||
yield securityChanged;
|
yield securityChanged;
|
||||||
|
|
||||||
ok(TrackingProtection.icon.hasAttribute("state"), "icon: state");
|
ok(TrackingProtection.icon.hasAttribute("state"), "icon: state");
|
||||||
@ -74,7 +72,7 @@ function* testTrackingProtectionAnimation() {
|
|||||||
|
|
||||||
info("Reload tracking tab");
|
info("Reload tracking tab");
|
||||||
securityChanged = waitForSecurityChange(2);
|
securityChanged = waitForSecurityChange(2);
|
||||||
browser.reload();
|
tabbrowser.reload();
|
||||||
yield securityChanged;
|
yield securityChanged;
|
||||||
|
|
||||||
ok(TrackingProtection.icon.hasAttribute("state"), "icon: state");
|
ok(TrackingProtection.icon.hasAttribute("state"), "icon: state");
|
||||||
@ -84,7 +82,7 @@ function* testTrackingProtectionAnimation() {
|
|||||||
add_task(function* testNormalBrowsing() {
|
add_task(function* testNormalBrowsing() {
|
||||||
yield UrlClassifierTestUtils.addTestTrackers();
|
yield UrlClassifierTestUtils.addTestTrackers();
|
||||||
|
|
||||||
browser = gBrowser;
|
tabbrowser = gBrowser;
|
||||||
|
|
||||||
TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
|
TrackingProtection = gBrowser.ownerGlobal.TrackingProtection;
|
||||||
ok(TrackingProtection, "TP is attached to the browser window");
|
ok(TrackingProtection, "TP is attached to the browser window");
|
||||||
@ -97,9 +95,9 @@ add_task(function* testNormalBrowsing() {
|
|||||||
|
|
||||||
add_task(function* testPrivateBrowsing() {
|
add_task(function* testPrivateBrowsing() {
|
||||||
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
let privateWin = yield promiseOpenAndLoadWindow({private: true}, true);
|
||||||
browser = privateWin.gBrowser;
|
tabbrowser = privateWin.gBrowser;
|
||||||
|
|
||||||
TrackingProtection = browser.ownerGlobal.TrackingProtection;
|
TrackingProtection = tabbrowser.ownerGlobal.TrackingProtection;
|
||||||
ok(TrackingProtection, "TP is attached to the private window");
|
ok(TrackingProtection, "TP is attached to the private window");
|
||||||
|
|
||||||
Services.prefs.setBoolPref(PB_PREF, true);
|
Services.prefs.setBoolPref(PB_PREF, true);
|
||||||
|
Loading…
Reference in New Issue
Block a user