diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /browser/base/content/test/plugins/browser_CTP_zoom.js | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/test/plugins/browser_CTP_zoom.js')
-rw-r--r-- | browser/base/content/test/plugins/browser_CTP_zoom.js | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/browser/base/content/test/plugins/browser_CTP_zoom.js b/browser/base/content/test/plugins/browser_CTP_zoom.js new file mode 100644 index 0000000000..eee2ec1837 --- /dev/null +++ b/browser/base/content/test/plugins/browser_CTP_zoom.js @@ -0,0 +1,61 @@ +"use strict"; + +var rootDir = getRootDirectory(gTestPath); +const gTestRoot = rootDir.replace( + "chrome://mochitests/content/", + "http://127.0.0.1:8888/" +); + +var gTestBrowser = null; + +add_task(async function() { + registerCleanupFunction(function() { + clearAllPluginPermissions(); + Services.prefs.clearUserPref("extensions.blocklist.suppressUI"); + FullZoom.reset(); // must be called before closing the tab we zoomed! + gBrowser.removeCurrentTab(); + window.focus(); + gTestBrowser = null; + }); +}); + +add_task(async function() { + Services.prefs.setBoolPref("extensions.blocklist.suppressUI", true); + + gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser); + gTestBrowser = gBrowser.selectedBrowser; + + await promiseTabLoadEvent( + gBrowser.selectedTab, + gTestRoot + "plugin_zoom.html" + ); + + // Work around for delayed PluginBindingAttached + await promiseUpdatePluginBindings(gTestBrowser); +}); + +// Enlarges the zoom level 4 times and tests that the overlay is +// visible after each enlargement. +add_task(async function() { + for (let count = 0; count < 4; count++) { + FullZoom.enlarge(); + + // Reload the page + await promiseTabLoadEvent( + gBrowser.selectedTab, + gTestRoot + "plugin_zoom.html" + ); + await promiseUpdatePluginBindings(gTestBrowser); + await SpecialPowers.spawn(gTestBrowser, [{ count }], async function(args) { + let doc = content.document; + let plugin = doc.getElementById("test"); + let overlay = plugin.openOrClosedShadowRoot.getElementById("main"); + Assert.ok( + overlay && + !overlay.classList.contains("visible") && + overlay.getAttribute("blockall") == "blockall", + "Overlay should be present for zoom change count " + args.count + ); + }); + } +}); |