blob: 1899475723dbbae7ee587193dc8672cb578a912d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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>
|