Bug 1602318 - Make some browser tests wait on the test uri to load instead of any uri. r=kmag

Differential Revision: https://phabricator.services.mozilla.com/D70624
This commit is contained in:
Matt Woodrow 2020-04-24 06:58:31 +00:00
Родитель f9c3d901f9
Коммит da08be6550
6 изменённых файлов: 47 добавлений и 40 удалений

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

@ -15,7 +15,7 @@ add_task(async function() {
let tab = BrowserTestUtils.addTab(gBrowser);
BrowserTestUtils.loadURI(tab.linkedBrowser, uri);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
await BrowserTestUtils.browserLoaded(tab.linkedBrowser, false, uri);
await TabStateFlusher.flush(tab.linkedBrowser);
let key = tab.linkedBrowser.permanentKey;

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

@ -84,7 +84,6 @@ skip-if = fission || debug # bug 1211084
[browser_backup_recovery.js]
skip-if = (verify && debug && (os == 'linux'))
[browser_broadcast.js]
skip-if = fission || (os == 'mac') || (os == 'linux' && !debug && bits == 64) # Bug 1533895; Fission: SecurityError: The operation is insecure.
[browser_capabilities.js]
[browser_cleaner.js]
[browser_crashedTabs.js]

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

@ -10,7 +10,7 @@ const INITIAL_VALUE = "browser_broadcast.js-initial-value-" + Date.now();
* closing a tab.
*/
add_task(async function flush_on_tabclose() {
let tab = await createTabWithStorageData(["http://example.com"]);
let tab = await createTabWithStorageData(["http://example.com/"]);
let browser = tab.linkedBrowser;
await modifySessionStorage(browser, { test: "on-tab-close" });
@ -33,7 +33,7 @@ add_task(async function flush_on_tabclose() {
* duplicating a tab.
*/
add_task(async function flush_on_duplicate() {
let tab = await createTabWithStorageData(["http://example.com"]);
let tab = await createTabWithStorageData(["http://example.com/"]);
let browser = tab.linkedBrowser;
await modifySessionStorage(browser, { test: "on-duplicate" });
@ -61,7 +61,7 @@ add_task(async function flush_on_duplicate() {
*/
add_task(async function flush_on_windowclose() {
let win = await promiseNewWindow();
let tab = await createTabWithStorageData(["http://example.com"], win);
let tab = await createTabWithStorageData(["http://example.com/"], win);
let browser = tab.linkedBrowser;
await modifySessionStorage(browser, { test: "on-window-close" });
@ -84,7 +84,7 @@ add_task(async function flush_on_windowclose() {
* (via e.g. setTabState) and does not overwrite the new data.
*/
add_task(async function flush_on_settabstate() {
let tab = await createTabWithStorageData(["http://example.com"]);
let tab = await createTabWithStorageData(["http://example.com/"]);
let browser = tab.linkedBrowser;
// Flush to make sure our tab state is up-to-date.
@ -115,7 +115,7 @@ add_task(async function flush_on_settabstate() {
* that hasn't been received by chrome, yet.
*/
add_task(async function flush_on_tabclose_racy() {
let tab = await createTabWithStorageData(["http://example.com"]);
let tab = await createTabWithStorageData(["http://example.com/"]);
let browser = tab.linkedBrowser;
// Flush to make sure we start with an empty queue.
@ -152,7 +152,8 @@ async function createTabWithStorageData(urls, win = window) {
for (let url of urls) {
BrowserTestUtils.loadURI(browser, url);
await promiseBrowserLoaded(browser);
await promiseBrowserLoaded(browser, true, url);
dump("Loaded url: " + url + "\n");
await modifySessionStorage(browser, { test: INITIAL_VALUE });
}

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

@ -55,11 +55,16 @@ add_task(async function checkCtrlWorks() {
expectedURL,
gBrowser.selectedBrowser
);
let promiseStopped = BrowserTestUtils.browserStopped(
gBrowser.selectedBrowser,
undefined,
true
);
gURLBar.focus();
gURLBar.inputField.value = inputValue.slice(0, -1);
EventUtils.sendString(inputValue.slice(-1));
EventUtils.synthesizeKey("KEY_Enter", options);
await promiseLoad;
await Promise.all([promiseLoad, promiseStopped]);
}
});

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

@ -87,7 +87,7 @@ var waitForLoad = async function(uri) {
};
gBrowser.selectedBrowser.webNavigation.loadURI(uri, loadURIOptions);
await BrowserTestUtils.browserStopped(gBrowser);
await BrowserTestUtils.browserStopped(gBrowser, uri);
};
// Tests referrerInfo when navigating from a page in the remote process to main

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

@ -32,38 +32,40 @@ function test() {
}
function doTest(aIsPrivateMode, aWindow, aCallback) {
BrowserTestUtils.browserLoaded(aWindow.gBrowser.selectedBrowser).then(
() => {
consoleObserver = {
observe(aSubject, aTopic, aData) {
if (aTopic == "console-api-log-event") {
afterEvents = ConsoleAPIStorage.getEvents(innerID);
is(
beforeEvents.length == afterEvents.length - 1,
storageShouldOccur,
"storage should" + (storageShouldOccur ? "" : " not") + " occur"
BrowserTestUtils.browserLoaded(
aWindow.gBrowser.selectedBrowser,
false,
testURI
).then(() => {
consoleObserver = {
observe(aSubject, aTopic, aData) {
if (aTopic == "console-api-log-event") {
afterEvents = ConsoleAPIStorage.getEvents(innerID);
is(
beforeEvents.length == afterEvents.length - 1,
storageShouldOccur,
"storage should" + (storageShouldOccur ? "" : " not") + " occur"
);
executeSoon(function() {
Services.obs.removeObserver(
consoleObserver,
"console-api-log-event"
);
aCallback();
});
}
},
};
executeSoon(function() {
Services.obs.removeObserver(
consoleObserver,
"console-api-log-event"
);
aCallback();
});
}
},
};
aWindow.Services.obs.addObserver(
consoleObserver,
"console-api-log-event"
);
aWindow.nativeConsole.log(
"foo bar baz (private: " + aIsPrivateMode + ")"
);
}
);
aWindow.Services.obs.addObserver(
consoleObserver,
"console-api-log-event"
);
aWindow.nativeConsole.log(
"foo bar baz (private: " + aIsPrivateMode + ")"
);
});
// We expect that console API messages are always stored.
storageShouldOccur = true;