Bug 1712898 introduce helper functions for reloading r=jib

Depends on D115994

Differential Revision: https://phabricator.services.mozilla.com/D115995
This commit is contained in:
Karl Tomlinson 2021-06-02 08:04:12 +00:00
parent 2b1c59ac97
commit 764066d093
2 changed files with 23 additions and 22 deletions

View File

@ -176,15 +176,7 @@ var gTests = [
await allow(true, true);
await closeStream();
info("Reload through the page");
await disableObserverVerification();
let reloaded = BrowserTestUtils.browserLoaded(browser);
await SpecialPowers.spawn(browser, [], () =>
content.document.location.reload()
);
await reloaded;
await enableObserverVerification();
await reloadFromContent();
info(
"After page reload, gUM(camera+mic) returns a stream " +
"without prompting within grace period."
@ -193,17 +185,7 @@ var gTests = [
await noPrompt(true, true);
await closeStream();
info("Reload as a user");
let reloadButton = document.getElementById("reload-button");
await disableObserverVerification();
await TestUtils.waitForCondition(() => {
return !reloadButton.disabled;
});
reloaded = BrowserTestUtils.browserLoaded(browser);
EventUtils.synthesizeMouseAtCenter(reloadButton, {});
await reloaded;
await enableObserverVerification();
await reloadAsUser();
info(
"After user page reload, gUM(camera+mic) returns a stream " +
"without prompting within grace period."

View File

@ -802,8 +802,24 @@ async function closeStream(
await assertWebRTCIndicatorStatus(null);
}
async function reloadAndAssertClosedStreams() {
info("reloading the web page");
async function reloadAsUser() {
info("reloading as a user");
const reloadButton = document.getElementById("reload-button");
await TestUtils.waitForCondition(() => !reloadButton.disabled);
// Disable observers as the page is being reloaded which can destroy
// the actors listening to the notifications.
await disableObserverVerification();
let loadedPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
reloadButton.click();
await loadedPromise;
await enableObserverVerification();
}
async function reloadFromContent() {
info("reloading from content");
// Disable observers as the page is being reloaded which can destroy
// the actors listening to the notifications.
@ -817,7 +833,10 @@ async function reloadAndAssertClosedStreams() {
await loadedPromise;
await enableObserverVerification();
}
async function reloadAndAssertClosedStreams() {
await reloadFromContent();
await checkNotSharing();
}