mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 22:05:44 +00:00
Bug 1235372, re-enable browser_private_search_perwindowpb.js in e10s, r=florian
This commit is contained in:
parent
21022fc197
commit
faaf66e72a
@ -36,7 +36,6 @@ skip-if = e10s # Bug ?????? - some issue with progress listeners [JavaScript Err
|
|||||||
[browser_oneOffHeader.js]
|
[browser_oneOffHeader.js]
|
||||||
skip-if = e10s # bug ?????? - Test alters the searchbar textbox value which causes issues with other tests in e10s.
|
skip-if = e10s # bug ?????? - Test alters the searchbar textbox value which causes issues with other tests in e10s.
|
||||||
[browser_private_search_perwindowpb.js]
|
[browser_private_search_perwindowpb.js]
|
||||||
skip-if = e10s # Bug ?????? - Test uses load event and checks event.target.
|
|
||||||
[browser_yahoo.js]
|
[browser_yahoo.js]
|
||||||
[browser_yahoo_behavior.js]
|
[browser_yahoo_behavior.js]
|
||||||
skip-if = e10s # Bug ?????? - some issue with progress listeners [JavaScript Error: "req.originalURI is null" {file: "chrome://mochitests/content/browser/browser/components/search/test/browser_bing_behavior.js" line: 127}]
|
skip-if = e10s # Bug ?????? - some issue with progress listeners [JavaScript Error: "req.originalURI is null" {file: "chrome://mochitests/content/browser/browser/components/search/test/browser_bing_behavior.js" line: 127}]
|
||||||
|
@ -2,103 +2,67 @@
|
|||||||
// search in a private window, and then checks in the public window
|
// search in a private window, and then checks in the public window
|
||||||
// whether there is an autocomplete entry for the private search.
|
// whether there is an autocomplete entry for the private search.
|
||||||
|
|
||||||
function test() {
|
add_task(function* () {
|
||||||
// Don't use about:home as the homepage for new windows
|
// Don't use about:home as the homepage for new windows
|
||||||
Services.prefs.setIntPref("browser.startup.page", 0);
|
Services.prefs.setIntPref("browser.startup.page", 0);
|
||||||
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.startup.page"));
|
registerCleanupFunction(() => Services.prefs.clearUserPref("browser.startup.page"));
|
||||||
|
|
||||||
waitForExplicitFinish();
|
|
||||||
|
|
||||||
let engineURL =
|
let engineURL =
|
||||||
"http://mochi.test:8888/browser/browser/components/search/test/";
|
"http://mochi.test:8888/browser/browser/components/search/test/";
|
||||||
let windowsToClose = [];
|
let windowsToClose = [];
|
||||||
registerCleanupFunction(function() {
|
|
||||||
let engine = Services.search.getEngineByName("Bug 426329");
|
|
||||||
Services.search.removeEngine(engine);
|
|
||||||
windowsToClose.forEach(function(win) {
|
|
||||||
win.close();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function onPageLoad(aWin, aCallback) {
|
function performSearch(aWin, aIsPrivate) {
|
||||||
aWin.gBrowser.addEventListener("DOMContentLoaded", function load(aEvent) {
|
|
||||||
let doc = aEvent.originalTarget;
|
|
||||||
info(doc.location.href);
|
|
||||||
if (doc.location.href.indexOf(engineURL) != -1) {
|
|
||||||
aWin.gBrowser.removeEventListener("DOMContentLoaded", load, false);
|
|
||||||
aCallback();
|
|
||||||
}
|
|
||||||
}, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
function performSearch(aWin, aIsPrivate, aCallback) {
|
|
||||||
let searchBar = aWin.BrowserSearch.searchBar;
|
let searchBar = aWin.BrowserSearch.searchBar;
|
||||||
ok(searchBar, "got search bar");
|
ok(searchBar, "got search bar");
|
||||||
onPageLoad(aWin, aCallback);
|
|
||||||
|
let loadPromise = BrowserTestUtils.browserLoaded(aWin.gBrowser.selectedBrowser);
|
||||||
|
|
||||||
searchBar.value = aIsPrivate ? "private test" : "public test";
|
searchBar.value = aIsPrivate ? "private test" : "public test";
|
||||||
searchBar.focus();
|
searchBar.focus();
|
||||||
EventUtils.synthesizeKey("VK_RETURN", {}, aWin);
|
EventUtils.synthesizeKey("VK_RETURN", {}, aWin);
|
||||||
|
|
||||||
|
return loadPromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addEngine(aCallback) {
|
function* testOnWindow(aIsPrivate) {
|
||||||
let installCallback = {
|
let win = yield BrowserTestUtils.openNewBrowserWindow({ private: aIsPrivate });
|
||||||
onSuccess: function (engine) {
|
yield SimpleTest.promiseFocus(win);
|
||||||
Services.search.currentEngine = engine;
|
|
||||||
aCallback();
|
|
||||||
},
|
|
||||||
onError: function (errorCode) {
|
|
||||||
ok(false, "failed to install engine: " + errorCode);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Services.search.addEngine(engineURL + "426329.xml", null,
|
|
||||||
"data:image/x-icon,%00", false, installCallback);
|
|
||||||
}
|
|
||||||
|
|
||||||
function testOnWindow(aIsPrivate, aCallback) {
|
|
||||||
let win = whenNewWindowLoaded({ private: aIsPrivate }, function() {
|
|
||||||
waitForFocus(aCallback, win);
|
|
||||||
});
|
|
||||||
windowsToClose.push(win);
|
windowsToClose.push(win);
|
||||||
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
addEngine(function() {
|
yield promiseNewEngine("426329.xml", { iconURL: "data:image/x-icon,%00" });
|
||||||
testOnWindow(false, function(win) {
|
|
||||||
performSearch(win, false, function() {
|
|
||||||
testOnWindow(true, function(win) {
|
|
||||||
performSearch(win, true, function() {
|
|
||||||
testOnWindow(false, function(win) {
|
|
||||||
checkSearchPopup(win, finish);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkSearchPopup(aWin, aCallback) {
|
let newWindow = yield* testOnWindow(false);
|
||||||
let searchBar = aWin.BrowserSearch.searchBar;
|
yield performSearch(newWindow, false);
|
||||||
|
|
||||||
|
newWindow = yield* testOnWindow(true);
|
||||||
|
yield performSearch(newWindow, true);
|
||||||
|
|
||||||
|
newWindow = yield* testOnWindow(false);
|
||||||
|
|
||||||
|
let searchBar = newWindow.BrowserSearch.searchBar;
|
||||||
searchBar.value = "p";
|
searchBar.value = "p";
|
||||||
searchBar.focus();
|
searchBar.focus();
|
||||||
|
|
||||||
let popup = searchBar.textbox.popup;
|
let popup = searchBar.textbox.popup;
|
||||||
popup.addEventListener("popupshowing", function showing() {
|
let popupPromise = BrowserTestUtils.waitForEvent(popup, "popupshown");
|
||||||
popup.removeEventListener("popupshowing", showing, false);
|
|
||||||
|
|
||||||
let entries = getMenuEntries(searchBar);
|
|
||||||
for (let i = 0; i < entries.length; i++) {
|
|
||||||
isnot(entries[i], "private test",
|
|
||||||
"shouldn't see private autocomplete entries");
|
|
||||||
}
|
|
||||||
|
|
||||||
searchBar.textbox.toggleHistoryPopup();
|
|
||||||
searchBar.value = "";
|
|
||||||
aCallback();
|
|
||||||
}, false);
|
|
||||||
|
|
||||||
searchBar.textbox.showHistoryPopup();
|
searchBar.textbox.showHistoryPopup();
|
||||||
}
|
yield popupPromise;
|
||||||
|
|
||||||
|
let entries = getMenuEntries(searchBar);
|
||||||
|
for (let i = 0; i < entries.length; i++) {
|
||||||
|
isnot(entries[i], "private test",
|
||||||
|
"shouldn't see private autocomplete entries");
|
||||||
|
}
|
||||||
|
|
||||||
|
searchBar.textbox.toggleHistoryPopup();
|
||||||
|
searchBar.value = "";
|
||||||
|
|
||||||
|
windowsToClose.forEach(function(win) {
|
||||||
|
win.close();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
function getMenuEntries(searchBar) {
|
function getMenuEntries(searchBar) {
|
||||||
let entries = [];
|
let entries = [];
|
||||||
|
@ -4,17 +4,6 @@
|
|||||||
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
|
||||||
"resource://gre/modules/Promise.jsm");
|
"resource://gre/modules/Promise.jsm");
|
||||||
|
|
||||||
function whenNewWindowLoaded(aOptions, aCallback) {
|
|
||||||
let win = OpenBrowserWindow(aOptions);
|
|
||||||
let focused = SimpleTest.promiseFocus(win);
|
|
||||||
let startupFinished = TestUtils.topicObserved("browser-delayed-startup-finished",
|
|
||||||
subject => subject == win).then(() => win);
|
|
||||||
Promise.all([focused, startupFinished])
|
|
||||||
.then(results => executeSoon(() => aCallback(results[1])));
|
|
||||||
|
|
||||||
return win;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively compare two objects and check that every property of expectedObj has the same value
|
* Recursively compare two objects and check that every property of expectedObj has the same value
|
||||||
* on actualObj.
|
* on actualObj.
|
||||||
@ -123,7 +112,7 @@ function promiseNewEngine(basename, options = {}) {
|
|||||||
onInitComplete: function() {
|
onInitComplete: function() {
|
||||||
let url = getRootDirectory(gTestPath) + basename;
|
let url = getRootDirectory(gTestPath) + basename;
|
||||||
let current = Services.search.currentEngine;
|
let current = Services.search.currentEngine;
|
||||||
Services.search.addEngine(url, null, "", false, {
|
Services.search.addEngine(url, null, options.iconURL || "", false, {
|
||||||
onSuccess: function (engine) {
|
onSuccess: function (engine) {
|
||||||
info("Search engine added: " + basename);
|
info("Search engine added: " + basename);
|
||||||
if (setAsCurrent) {
|
if (setAsCurrent) {
|
||||||
|
Loading…
Reference in New Issue
Block a user