forked from mirrors/gecko-dev
* Toggle animate=false attribute on arrow panels when toolkit.cosmeticAnimations.enabled is false * Use preferences-service component to lookup the pref in the arrowpanel binding * Disable this pref during tests to remove a source of instability and timing-based test failures in chrome/UI tests. * Enable cosmeticAnimations for tests which depend on existing behavior MozReview-Commit-ID: IvA2ySPPmeJ --HG-- extra : rebase_source : 4ed74175107b2cf831b698361f0a2a9b1bd72113
97 lines
4.5 KiB
JavaScript
97 lines
4.5 KiB
JavaScript
async function waitForNoAnimation(elt) {
|
|
return BrowserTestUtils.waitForCondition(() => !elt.hasAttribute("animate"));
|
|
}
|
|
|
|
async function getAnimatePromise(elt) {
|
|
return BrowserTestUtils.waitForAttribute("animate", elt)
|
|
.then(() => Assert.ok(true, `${elt.id} should animate`));
|
|
}
|
|
|
|
function stopReloadMutationCallback() {
|
|
Assert.ok(false, "stop-reload's animate attribute should not have been mutated");
|
|
}
|
|
|
|
// run these tests with notification animations enabled
|
|
add_task(async function setup() {
|
|
await SpecialPowers.pushPrefEnv({
|
|
"set": [["toolkit.cosmeticAnimations.enabled", true]]
|
|
});
|
|
});
|
|
|
|
add_task(async function checkDontShowStopOnNewTab() {
|
|
let stopReloadContainer = document.getElementById("stop-reload-button");
|
|
let stopReloadContainerObserver = new MutationObserver(stopReloadMutationCallback);
|
|
|
|
await waitForNoAnimation(stopReloadContainer);
|
|
stopReloadContainerObserver.observe(stopReloadContainer, { attributeFilter: ["animate"]});
|
|
let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser,
|
|
opening: "about:robots",
|
|
waitForStateStop: true});
|
|
await BrowserTestUtils.removeTab(tab);
|
|
|
|
Assert.ok(true, "Test finished: stop-reload does not animate when navigating to local URI on new tab");
|
|
stopReloadContainerObserver.disconnect();
|
|
});
|
|
|
|
add_task(async function checkDontShowStopFromLocalURI() {
|
|
let stopReloadContainer = document.getElementById("stop-reload-button");
|
|
let stopReloadContainerObserver = new MutationObserver(stopReloadMutationCallback);
|
|
|
|
let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser,
|
|
opening: "about:robots",
|
|
waitForStateStop: true});
|
|
await waitForNoAnimation(stopReloadContainer);
|
|
stopReloadContainerObserver.observe(stopReloadContainer, { attributeFilter: ["animate"]});
|
|
await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla");
|
|
await BrowserTestUtils.removeTab(tab);
|
|
|
|
Assert.ok(true, "Test finished: stop-reload does not animate when navigating between local URIs");
|
|
stopReloadContainerObserver.disconnect();
|
|
});
|
|
|
|
add_task(async function checkDontShowStopFromNonLocalURI() {
|
|
let stopReloadContainer = document.getElementById("stop-reload-button");
|
|
let stopReloadContainerObserver = new MutationObserver(stopReloadMutationCallback);
|
|
|
|
let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser,
|
|
opening: "https://example.com",
|
|
waitForStateStop: true});
|
|
await waitForNoAnimation(stopReloadContainer);
|
|
stopReloadContainerObserver.observe(stopReloadContainer, { attributeFilter: ["animate"]});
|
|
await BrowserTestUtils.loadURI(tab.linkedBrowser, "about:mozilla");
|
|
await BrowserTestUtils.removeTab(tab);
|
|
|
|
Assert.ok(true, "Test finished: stop-reload does not animate when navigating to local URI from non-local URI");
|
|
stopReloadContainerObserver.disconnect();
|
|
});
|
|
|
|
add_task(async function checkDoShowStopOnNewTab() {
|
|
let stopReloadContainer = document.getElementById("stop-reload-button");
|
|
let animatePromise = getAnimatePromise(stopReloadContainer);
|
|
|
|
await waitForNoAnimation(stopReloadContainer);
|
|
let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser,
|
|
opening: "https://example.com",
|
|
waitForStateStop: true});
|
|
await animatePromise;
|
|
await waitForNoAnimation(stopReloadContainer);
|
|
await BrowserTestUtils.removeTab(tab);
|
|
|
|
info("Test finished: stop-reload animates when navigating to non-local URI on new tab");
|
|
});
|
|
|
|
add_task(async function checkDoShowStopFromLocalURI() {
|
|
let stopReloadContainer = document.getElementById("stop-reload-button");
|
|
|
|
await waitForNoAnimation(stopReloadContainer);
|
|
let tab = await BrowserTestUtils.openNewForegroundTab({gBrowser,
|
|
opening: "about:robots",
|
|
waitForStateStop: true});
|
|
let animatePromise = getAnimatePromise(stopReloadContainer);
|
|
await BrowserTestUtils.loadURI(tab.linkedBrowser, "https://example.com");
|
|
await animatePromise;
|
|
await waitForNoAnimation(stopReloadContainer);
|
|
await BrowserTestUtils.removeTab(tab);
|
|
|
|
info("Test finished: stop-reload animates when navigating to non-local URI from local URI");
|
|
});
|