mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1132566 - Make test e10s compatible: browser_privatebrowsing_geoprompt.js; r=mconley
This commit is contained in:
parent
b2ff6a7272
commit
3aaebba343
@ -31,7 +31,6 @@ skip-if = e10s # Bug 1139953 - Accept cookie dialog shown in private window when
|
||||
[browser_privatebrowsing_downloadLastDir_c.js]
|
||||
[browser_privatebrowsing_downloadLastDir_toggle.js]
|
||||
[browser_privatebrowsing_geoprompt.js]
|
||||
skip-if = e10s
|
||||
[browser_privatebrowsing_lastpbcontextexited.js]
|
||||
skip-if = e10s
|
||||
[browser_privatebrowsing_localStorage.js]
|
||||
|
@ -5,65 +5,50 @@
|
||||
// This test makes sure that the geolocation prompt does not show a remember
|
||||
// control inside the private browsing mode.
|
||||
|
||||
function test() {
|
||||
add_task(function* test() {
|
||||
const testPageURL = "http://mochi.test:8888/browser/" +
|
||||
"browser/components/privatebrowsing/test/browser/browser_privatebrowsing_geoprompt_page.html";
|
||||
waitForExplicitFinish();
|
||||
|
||||
function checkGeolocation(aPrivateMode, aWindow, aCallback) {
|
||||
executeSoon(function() {
|
||||
aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab();
|
||||
aWindow.gBrowser.selectedBrowser.addEventListener("load", function () {
|
||||
if (aWindow.content.location != testPageURL) {
|
||||
aWindow.content.location = testPageURL;
|
||||
return;
|
||||
}
|
||||
aWindow.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
|
||||
function checkGeolocation(aPrivateMode, aWindow) {
|
||||
return Task.spawn(function* () {
|
||||
aWindow.gBrowser.selectedTab = aWindow.gBrowser.addTab(testPageURL);
|
||||
yield BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser);
|
||||
|
||||
function runTest() {
|
||||
let notification = aWindow.PopupNotifications.getNotification("geolocation");
|
||||
if (!notification) {
|
||||
// Wait until the notification is available
|
||||
executeSoon(runTest);
|
||||
return;
|
||||
}
|
||||
if (aPrivateMode) {
|
||||
// Make sure the notification is correctly displayed without a remember control
|
||||
is(notification.secondaryActions.length, 0, "Secondary actions shouldn't exist (always/never remember)");
|
||||
} else {
|
||||
ok(notification.secondaryActions.length > 1, "Secondary actions should exist (always/never remember)");
|
||||
}
|
||||
notification.remove();
|
||||
let notification = aWindow.PopupNotifications.getNotification("geolocation");
|
||||
|
||||
aWindow.gBrowser.removeCurrentTab();
|
||||
aCallback();
|
||||
}
|
||||
runTest();
|
||||
}, true);
|
||||
// Wait until the notification is available.
|
||||
while (!notification){
|
||||
yield new Promise(resolve => { executeSoon(resolve); });
|
||||
let notification = aWindow.PopupNotifications.getNotification("geolocation");
|
||||
}
|
||||
|
||||
if (aPrivateMode) {
|
||||
// Make sure the notification is correctly displayed without a remember control
|
||||
is(notification.secondaryActions.length, 0, "Secondary actions shouldn't exist (always/never remember)");
|
||||
} else {
|
||||
ok(notification.secondaryActions.length > 1, "Secondary actions should exist (always/never remember)");
|
||||
}
|
||||
notification.remove();
|
||||
|
||||
aWindow.gBrowser.removeCurrentTab();
|
||||
});
|
||||
};
|
||||
|
||||
let windowsToClose = [];
|
||||
function testOnWindow(options, callback) {
|
||||
let win = OpenBrowserWindow(options);
|
||||
win.addEventListener("load", function onLoad() {
|
||||
win.removeEventListener("load", onLoad, false);
|
||||
windowsToClose.push(win);
|
||||
callback(win);
|
||||
}, false);
|
||||
};
|
||||
let win = yield BrowserTestUtils.openNewBrowserWindow();
|
||||
let browser = win.gBrowser.selectedBrowser;
|
||||
browser.loadURI(testPageURL);
|
||||
yield BrowserTestUtils.browserLoaded(browser);
|
||||
|
||||
registerCleanupFunction(function() {
|
||||
windowsToClose.forEach(function(win) {
|
||||
win.close();
|
||||
});
|
||||
});
|
||||
yield checkGeolocation(false, win);
|
||||
|
||||
testOnWindow({private: false}, function(win) {
|
||||
checkGeolocation(false, win, function() {
|
||||
testOnWindow({private: true}, function(win) {
|
||||
checkGeolocation(true, win, finish);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
let privateWin = yield BrowserTestUtils.openNewBrowserWindow({private: true});
|
||||
let privateBrowser = privateWin.gBrowser.selectedBrowser;
|
||||
privateBrowser.loadURI(testPageURL);
|
||||
yield BrowserTestUtils.browserLoaded(privateBrowser);
|
||||
|
||||
yield checkGeolocation(true, privateWin);
|
||||
|
||||
// Cleanup
|
||||
yield BrowserTestUtils.closeWindow(win);
|
||||
yield BrowserTestUtils.closeWindow(privateWin);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user