summaryrefslogtreecommitdiffstats
path: root/toolkit/components/extensions/test/mochitest/test_ext_action.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /toolkit/components/extensions/test/mochitest/test_ext_action.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/extensions/test/mochitest/test_ext_action.html')
-rw-r--r--toolkit/components/extensions/test/mochitest/test_ext_action.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/toolkit/components/extensions/test/mochitest/test_ext_action.html b/toolkit/components/extensions/test/mochitest/test_ext_action.html
new file mode 100644
index 0000000000..1899475723
--- /dev/null
+++ b/toolkit/components/extensions/test/mochitest/test_ext_action.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Action with MV3</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
+ <script type="text/javascript" src="head.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
+</head>
+<body>
+
+<script type="text/javascript">
+"use strict";
+
+
+add_task(async function setup() {
+ await SpecialPowers.pushPrefEnv({
+ set: [["extensions.manifestV3.enabled", true]],
+ });
+});
+
+add_task(async function test_action_onClicked() {
+ const extension = ExtensionTestUtils.loadExtension({
+ manifest: {
+ manifest_version: 3,
+ action: {},
+ },
+ background() {
+ browser.action.onClicked.addListener(async () => {
+ browser.test.notifyPass("action-clicked");
+ });
+
+ browser.test.sendMessage("background-ready");
+ },
+ });
+
+ await extension.startup();
+ await extension.awaitMessage("background-ready");
+
+ await AppTestDelegate.clickBrowserAction(window, extension);
+ await extension.awaitFinish("action-clicked");
+ await AppTestDelegate.closeBrowserAction(window, extension);
+
+ await extension.unload();
+});
+
+</script>
+
+</body>
+</html>