Bug 1330076 - Rewrite test_chrome_ext_shutdown_cleanup.html into an xpcshell test r=aswan

MozReview-Commit-ID: 52AITgCDmJy

--HG--
rename : toolkit/components/extensions/test/mochitest/test_chrome_ext_shutdown_cleanup.html => toolkit/components/extensions/test/xpcshell/test_ext_shutdown_cleanup.js
extra : rebase_source : 9a391f665adc545046d3d4c6283397661c32ef88
This commit is contained in:
Luca Greco 2017-01-10 22:00:33 +01:00
parent 208b9bd902
commit c482638d73
4 changed files with 31 additions and 51 deletions

View File

@ -21,7 +21,6 @@ skip-if = (os == 'android') # browser.tabs is undefined. Bug 1258975 on android.
[test_chrome_ext_trustworthy_origin.html]
[test_chrome_ext_webnavigation_resolved_urls.html]
skip-if = (os == 'android') # browser.tabs is undefined. Bug 1258975 on android.
[test_chrome_ext_shutdown_cleanup.html]
[test_chrome_native_messaging_paths.html]
skip-if = os != "mac" && os != "linux"
[test_ext_cookies_expiry.html]

View File

@ -1,50 +0,0 @@
<!DOCTYPE HTML>
<html>
<head>
<title>WebExtension test</title>
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
<script src="chrome://mochikit/content/tests/SimpleTest/ExtensionTestUtils.js"></script>
<script type="text/javascript" src="head.js"></script>
<link rel="stylesheet" href="chrome://mochikit/contents/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="text/javascript">
"use strict";
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://testing-common/TestUtils.jsm");
const {GlobalManager} = Cu.import("resource://gre/modules/Extension.jsm", {});
/* eslint-disable mozilla/balanced-listeners */
add_task(function* testShutdownCleanup() {
is(GlobalManager.initialized, false,
"GlobalManager start as not initialized");
let extension = ExtensionTestUtils.loadExtension({
background: function() {
browser.test.notifyPass("background page loaded");
},
});
yield extension.startup();
yield extension.awaitFinish("background page loaded");
is(GlobalManager.initialized, true,
"GlobalManager has been initialized once an extension is started");
yield extension.unload();
is(GlobalManager.initialized, false,
"GlobalManager has been uninitialized once all the webextensions have been stopped");
});
</script>
</body>
</html>

View File

@ -0,0 +1,30 @@
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";
const {GlobalManager} = Cu.import("resource://gre/modules/Extension.jsm", {});
add_task(function* test_global_manager_shutdown_cleanup() {
equal(GlobalManager.initialized, false,
"GlobalManager start as not initialized");
function background() {
browser.test.notifyPass("background page loaded");
}
let extension = ExtensionTestUtils.loadExtension({
background,
});
yield extension.startup();
yield extension.awaitFinish("background page loaded");
equal(GlobalManager.initialized, true,
"GlobalManager has been initialized once an extension is started");
yield extension.unload();
equal(GlobalManager.initialized, false,
"GlobalManager has been uninitialized once all the webextensions have been stopped");
});

View File

@ -58,6 +58,7 @@ skip-if = release_or_beta
[test_ext_schemas_api_injection.js]
[test_ext_schemas_async.js]
[test_ext_schemas_allowed_contexts.js]
[test_ext_shutdown_cleanup.js]
[test_ext_simple.js]
[test_ext_storage.js]
[test_ext_storage_sync.js]