summaryrefslogtreecommitdiffstats
path: root/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_periodic.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/webextensions/test/xpcshell/test_ext_alarms_periodic.js')
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_alarms_periodic.js44
1 files changed, 0 insertions, 44 deletions
diff --git a/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_periodic.js b/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_periodic.js
deleted file mode 100644
index 6bcdf4e33..000000000
--- a/toolkit/components/webextensions/test/xpcshell/test_ext_alarms_periodic.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
-/* vim: set sts=2 sw=2 et tw=80: */
-"use strict";
-
-add_task(function* test_periodic_alarm_fires() {
- function backgroundScript() {
- const ALARM_NAME = "test_ext_alarms";
- let count = 0;
- let timer;
-
- browser.alarms.onAlarm.addListener(async alarm => {
- browser.test.assertEq(alarm.name, ALARM_NAME, "alarm has the expected name");
- if (count++ === 3) {
- clearTimeout(timer);
- let wasCleared = await browser.alarms.clear(ALARM_NAME);
- browser.test.assertTrue(wasCleared, "alarm was cleared");
-
- browser.test.notifyPass("alarm-periodic");
- }
- });
-
- browser.alarms.create(ALARM_NAME, {periodInMinutes: 0.02});
-
- timer = setTimeout(async () => {
- browser.test.fail("alarm fired expected number of times");
-
- let wasCleared = await browser.alarms.clear(ALARM_NAME);
- browser.test.assertTrue(wasCleared, "alarm was cleared");
-
- browser.test.notifyFail("alarm-periodic");
- }, 30000);
- }
-
- let extension = ExtensionTestUtils.loadExtension({
- background: `(${backgroundScript})()`,
- manifest: {
- permissions: ["alarms"],
- },
- });
-
- yield extension.startup();
- yield extension.awaitFinish("alarm-periodic");
- yield extension.unload();
-});