Bug 1651976: Update test browser_bug731866.js and browser_bug795764_cachedisabled.js to work correctly based on whether HTTPS-Only Mode preference if flipped to true of false. r=Gijs,preferences-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D83106
This commit is contained in:
Christoph Kerschbaumer 2020-07-10 23:08:54 +00:00
Родитель 387e23f588
Коммит c5e2dceec6
2 изменённых файлов: 24 добавлений и 0 удалений

Просмотреть файл

@ -5,6 +5,10 @@ const browserContainersGroupDisabled = !SpecialPowers.getBoolPref(
"privacy.userContext.ui.enabled"
);
const httpsOnlyVisible = SpecialPowers.getBoolPref(
"browser.preferences.exposeHTTPSOnly"
);
function test() {
waitForExplicitFinish();
open_preferences(runTest);
@ -32,6 +36,12 @@ function checkElements(expectedPane) {
continue;
}
// HTTPS-Only Mode is exposed depending on the preference.
if (element.id == "httpsOnlyBox" && !httpsOnlyVisible) {
is_element_hidden(element, "Disabled httpsOnlyBox should be hidden");
continue;
}
let attributeValue = element.getAttribute("data-category");
let suffix = " (id=" + element.id + ")";
if (attributeValue == "pane" + expectedPane) {

Просмотреть файл

@ -1,6 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const httpsOnlyVisible = SpecialPowers.getBoolPref(
"browser.preferences.exposeHTTPSOnly"
);
function test() {
waitForExplicitFinish();
@ -34,6 +38,16 @@ async function runTest(win) {
for (let element of elements) {
let attributeValue = element.getAttribute("data-category");
if (attributeValue == "panePrivacy") {
// HTTPS-Only Mode is exposed depending on the preference.
if (element.id == "httpsOnlyBox") {
if (httpsOnlyVisible) {
is_element_visible(element, "HTTPSOnly should be visible");
} else {
is_element_hidden(element, "HTTPSOnly should not be visible");
}
continue;
}
is_element_visible(
element,
`Privacy element of id=${element.id} should be visible`