Bug 1365133 - Update tests - Part 3. r=jaws

MozReview-Commit-ID: GoOXdJ4RfY9

--HG--
extra : rebase_source : 69f805c04f050cf588fa9454116f263e19be7d8f
This commit is contained in:
Evan Tseng 2017-06-20 15:11:46 +08:00
Родитель 9db9d083ed
Коммит c8a5fc0bb8
12 изменённых файлов: 38 добавлений и 30 удалений

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

@ -288,6 +288,11 @@ var gPrivacyPane = {
bundlePrefs.getString("removeAllCookies.label"),
bundlePrefs.getString("removeSelectedCookies.label"),
]);
// Notify observers that the UI is now ready
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.notifyObservers(window, "privacy-pane-loaded");
},
// TRACKING PROTECTION MODE

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

@ -5,8 +5,8 @@ var container;
SimpleTest.requestCompleteLog();
add_task(async function setup() {
await openPreferencesViaOpenPreferencesAPI("applications", {leaveOpen: true});
info("Preferences page opened on the applications pane.");
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
info("Preferences page opened on the paneGeneral pane.");
registerCleanupFunction(() => {
gBrowser.removeCurrentTab();

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

@ -11,8 +11,8 @@ registerCleanupFunction(function() {
add_task(async function() {
originalWindowHeight = window.outerHeight;
window.resizeTo(window.outerWidth, 300);
let prefs = await openPreferencesViaOpenPreferencesAPI("paneApplications", {leaveOpen: true});
is(prefs.selectedPane, "paneApplications", "Applications pane was selected");
let prefs = await openPreferencesViaOpenPreferencesAPI("paneSearch", {leaveOpen: true});
is(prefs.selectedPane, "paneSearch", "Search pane was selected");
let mainContent = gBrowser.contentDocument.querySelector(".main-content");
mainContent.scrollTop = 50;
is(mainContent.scrollTop, 50, "main-content should be scrolled 50 pixels");
@ -21,4 +21,3 @@ add_task(async function() {
is(mainContent.scrollTop, 0,
"Switching to a different category should reset the scroll position");
});

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

@ -11,8 +11,6 @@ registerCleanupFunction(function() {
add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("panePrivacy");
is(prefs.selectedPane, "panePrivacy", "Privacy pane was selected");
prefs = await openPreferencesViaOpenPreferencesAPI("advanced");
is(prefs.selectedPane, "paneAdvanced", "Advanced pane was selected");
prefs = await openPreferencesViaHash("privacy");
is(prefs.selectedPane, "panePrivacy", "Privacy pane is selected when hash is 'privacy'");
prefs = await openPreferencesViaOpenPreferencesAPI("nonexistant-category");
@ -26,7 +24,6 @@ add_task(async function() {
let doc = gBrowser.contentDocument;
is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI");
ok(doc.querySelector("#locationBarGroup").hidden, "Location Bar prefs should be hidden when only Reports are requested");
ok(!doc.querySelector("#header-privacy").hidden, "The header should be visible when a subcategory is requested");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
prefs = await openPreferencesViaOpenPreferencesAPI("general-search", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
@ -54,7 +51,6 @@ add_task(async function() {
is(selectedPane, "panePrivacy", "Privacy pane should be selected");
is(doc.location.hash, "#privacy", "The subcategory should be removed from the URI");
ok(doc.querySelector("#locationBarGroup").hidden, "Location Bar prefs should be hidden when only Reports are requested");
ok(!doc.querySelector("#header-privacy").hidden, "The header should be visible when a subcategory is requested");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});

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

@ -40,7 +40,7 @@ add_task(async function() {
await checkPageScrolling(container, "radio");
});
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences" }, async function(browser) {
await BrowserTestUtils.withNewTab({ gBrowser, url: "about:preferences#search" }, async function(browser) {
let doc = browser.contentDocument;
let container = doc.getElementsByClassName("main-content")[0];

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

@ -62,8 +62,8 @@ function runTest(win) {
gElements = tab.getElementById("mainPrefPane").children;
let panes = [
"General", "Applications",
"Privacy", "Sync", "Advanced",
"General", "Search",
"Privacy", "Sync",
];
for (let pane of panes) {

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

@ -1,7 +1,7 @@
// Test Engine list
add_task(async function() {
let prefs = await openPreferencesViaOpenPreferencesAPI("general-search", {leaveOpen: true});
is(prefs.selectedPane, "paneGeneral", "General pane is selected by default");
let prefs = await openPreferencesViaOpenPreferencesAPI("search", {leaveOpen: true});
is(prefs.selectedPane, "paneSearch", "Search pane is selected by default");
let doc = gBrowser.contentDocument;
let tree = doc.querySelector("#engineList");

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

@ -51,6 +51,6 @@ add_task(async function() {
*/
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("paneGeneral", {leaveOpen: true});
evaluateSearchResults("request permission again", "notificationsGroup");
evaluateSearchResults("request permission again", "permissionsGroup");
await BrowserTestUtils.removeTab(gBrowser.selectedTab);
});

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

@ -110,16 +110,24 @@ add_task(async function() {
// Checks if back to generalPane
for (let i = 0; i < mainPrefTag.childElementCount; i++) {
let child = mainPrefTag.children[i]
if (child.id == "startupGroup"
|| child.id == "defaultEngineGroup"
|| child.id == "oneClickSearchProvidersGroup"
|| child.id == "paneGeneral"
|| child.id == "accessibilityGroup"
if (child.id == "paneGeneral"
|| child.id == "startupGroup"
|| child.id == "languagesGroup"
|| child.id == "fontsGroup"
|| child.id == "downloadsGroup"
|| child.id == "applicationsGroup"
|| child.id == "drmGroup"
|| child.id == "updateApp"
|| child.id == "browsingGroup"
|| child.id == "performanceGroup"
|| child.id == "header-general") {
|| child.id == "connectionGroup"
|| child.id == "generalCategory"
|| child.id == "languageAndAppearanceCategory"
|| child.id == "filesAndApplicationsCategory"
|| child.id == "updatesCategory"
|| child.id == "performanceCategory"
|| child.id == "browsingCategory"
|| child.id == "networkProxyCategory") {
is_element_visible(child, "Should be in general tab");
} else if (child.id) {
is_element_hidden(child, "Should not be in general tab");
@ -161,7 +169,7 @@ add_task(async function() {
*/
add_task(async function() {
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let generalPane = gBrowser.contentDocument.getElementById("header-general");
let generalPane = gBrowser.contentDocument.getElementById("generalCategory");
is_element_hidden(generalPane, "Should not be in general");
@ -188,7 +196,7 @@ add_task(async function() {
add_task(async function() {
await SpecialPowers.pushPrefEnv({"set": [["browser.storageManager.enabled", false]]});
await openPreferencesViaOpenPreferencesAPI("privacy", {leaveOpen: true});
let generalPane = gBrowser.contentDocument.getElementById("header-general");
let generalPane = gBrowser.contentDocument.getElementById("generalCategory");
is_element_hidden(generalPane, "Should not be in general");

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

@ -8,7 +8,7 @@ registerCleanupFunction(() => {
add_task(async function() {
Services.prefs.setBoolPref("browser.search.suggest.enabled", true);
await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
await openPreferencesViaOpenPreferencesAPI("search", { leaveOpen: true });
let doc = gBrowser.selectedBrowser.contentDocument;
let urlbarBox = doc.getElementById("urlBarSuggestion");
@ -25,7 +25,7 @@ add_task(async function() {
add_task(async function() {
Services.prefs.setBoolPref("browser.search.suggest.enabled", false);
await openPreferencesViaOpenPreferencesAPI("general", { leaveOpen: true });
await openPreferencesViaOpenPreferencesAPI("search", { leaveOpen: true });
let doc = gBrowser.selectedBrowser.contentDocument;
let urlbarBox = doc.getElementById("urlBarSuggestion");

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

@ -1584,7 +1584,7 @@ var gViewController = {
if (Preferences.get("browser.preferences.useOldOrganization")) {
mainWindow.openAdvancedPreferences("dataChoicesTab", {origin: "experimentsOpenPref"});
} else {
mainWindow.openPreferences("paneAdvanced", {origin: "experimentsOpenPref"});
mainWindow.openPreferences("panePrivacy", {origin: "experimentsOpenPref"});
}
},
},

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

@ -169,13 +169,13 @@ add_task(async function testOpenPreferences() {
let deferred = Promise.defer();
Services.obs.addObserver(function observer(prefWin, topic, data) {
Services.obs.removeObserver(observer, "advanced-pane-loaded");
info("Advanced preference pane opened.");
Services.obs.removeObserver(observer, "privacy-pane-loaded");
info("Privacy preference pane opened.");
executeSoon(function() {
// We want this test to fail if the preferences pane changes,
// but we can't check if the data-choices button is visible
// since it is only in the DOM when MOZ_TELEMETRY_REPORTING=1.
let el = prefWin.document.getElementById("header-advanced");
let el = prefWin.document.getElementById("dataCollectionCategory");
is_element_visible(el);
prefWin.close();
@ -183,7 +183,7 @@ add_task(async function testOpenPreferences() {
deferred.resolve();
});
}, "advanced-pane-loaded");
}, "privacy-pane-loaded");
info("Loading preferences pane.");
// We need to focus before synthesizing the mouse event (bug 1240052) as