зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1857204 - Fix cookie banner handling click test beta merge failures. r=timhuang
Differential Revision: https://phabricator.services.mozilla.com/D190180
This commit is contained in:
Родитель
760ecad647
Коммит
141cd2a751
|
@ -14,6 +14,9 @@ add_setup(clickTestSetup);
|
|||
* @param {*} options.openPageOptions - Options to overwrite for the openPageAndVerify call.
|
||||
*/
|
||||
async function runTest({ mode, detectOnly = false, openPageOptions = {} }) {
|
||||
if (mode == null) {
|
||||
throw new Error("Invalid cookie banner service mode.");
|
||||
}
|
||||
let initFn = () => {
|
||||
// Insert rules only if the feature is enabled.
|
||||
if (Services.cookieBanners.isEnabled) {
|
||||
|
@ -23,6 +26,7 @@ async function runTest({ mode, detectOnly = false, openPageOptions = {} }) {
|
|||
|
||||
let shouldHandleBanner =
|
||||
mode == Ci.nsICookieBannerService.MODE_REJECT && !detectOnly;
|
||||
let expectActorEnabled = mode != Ci.nsICookieBannerService.MODE_DISABLED;
|
||||
let testURL = openPageOptions.testURL || TEST_PAGE_A;
|
||||
let triggerFn = async () => {
|
||||
await openPageAndVerify({
|
||||
|
@ -32,6 +36,7 @@ async function runTest({ mode, detectOnly = false, openPageOptions = {} }) {
|
|||
visible: !shouldHandleBanner,
|
||||
expected: shouldHandleBanner ? "OptOut" : "NoClick",
|
||||
keepTabOpen: true,
|
||||
expectActorEnabled,
|
||||
...openPageOptions, // Allow test callers to override any options for this method.
|
||||
});
|
||||
};
|
||||
|
@ -83,7 +88,7 @@ add_task(async function test_events_mode_detect_only_opt_in_rule() {
|
|||
});
|
||||
|
||||
/**
|
||||
* Test the banner clicking events with detect-only mode.
|
||||
* Test the banner clicking events in disabled mode.
|
||||
*/
|
||||
add_task(async function test_events_mode_disabled() {
|
||||
await runTest({ mode: Ci.nsICookieBannerService.MODE_DISABLED });
|
||||
|
|
|
@ -462,6 +462,10 @@ async function runEventTest({ mode, detectOnly, initFn, triggerFn, testURL }) {
|
|||
await SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["cookiebanners.service.mode", mode],
|
||||
[
|
||||
"cookiebanners.service.mode.privateBrowsing",
|
||||
Ci.nsICookieBannerService.MODE_DISABLED,
|
||||
],
|
||||
["cookiebanners.service.detectOnly", detectOnly],
|
||||
],
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче