зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1637716 - Shutdown AddonManager at end of test. r=mixedpuppy
Differential Revision: https://phabricator.services.mozilla.com/D76787
This commit is contained in:
Родитель
0b581d46a0
Коммит
81a969c1f1
|
@ -9,10 +9,14 @@ const { AddonTestUtils } = ChromeUtils.import(
|
||||||
const { AddonManager } = ChromeUtils.import(
|
const { AddonManager } = ChromeUtils.import(
|
||||||
"resource://gre/modules/AddonManager.jsm"
|
"resource://gre/modules/AddonManager.jsm"
|
||||||
);
|
);
|
||||||
|
const { ExtensionTestUtils } = ChromeUtils.import(
|
||||||
|
"resource://testing-common/ExtensionXPCShellUtils.jsm"
|
||||||
|
);
|
||||||
|
|
||||||
AddonTestUtils.init(this);
|
AddonTestUtils.init(this);
|
||||||
AddonTestUtils.overrideCertDB();
|
AddonTestUtils.overrideCertDB();
|
||||||
AddonTestUtils.appInfo = getAppInfo();
|
AddonTestUtils.appInfo = getAppInfo();
|
||||||
|
ExtensionTestUtils.init(this);
|
||||||
|
|
||||||
const server = AddonTestUtils.createHttpServer({ hosts: ["example.com"] });
|
const server = AddonTestUtils.createHttpServer({ hosts: ["example.com"] });
|
||||||
const BASE_URL = `http://example.com/data`;
|
const BASE_URL = `http://example.com/data`;
|
||||||
|
@ -35,9 +39,9 @@ add_task(async function test_local_addon_update() {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
xpi1.copyTo(tmpDir, TEST_NAME);
|
xpi1.copyTo(tmpDir, TEST_NAME);
|
||||||
|
let extension = ExtensionTestUtils.expectExtension(id);
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
AddonTestUtils.promiseInstallEvent("onInstallEnded"),
|
extension.awaitStartup(),
|
||||||
setupPolicyEngineWithJson({
|
setupPolicyEngineWithJson({
|
||||||
policies: {
|
policies: {
|
||||||
ExtensionSettings: {
|
ExtensionSettings: {
|
||||||
|
@ -64,8 +68,9 @@ add_task(async function test_local_addon_update() {
|
||||||
// overwrite the test file
|
// overwrite the test file
|
||||||
xpi2.copyTo(tmpDir, TEST_NAME);
|
xpi2.copyTo(tmpDir, TEST_NAME);
|
||||||
|
|
||||||
|
extension = ExtensionTestUtils.expectExtension(id);
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
AddonTestUtils.promiseInstallEvent("onInstallEnded"),
|
extension.awaitStartup(),
|
||||||
setupPolicyEngineWithJson({
|
setupPolicyEngineWithJson({
|
||||||
policies: {
|
policies: {
|
||||||
ExtensionSettings: {
|
ExtensionSettings: {
|
||||||
|
@ -111,8 +116,9 @@ add_task(async function test_newurl_addon_update() {
|
||||||
});
|
});
|
||||||
server.registerFile("/data/policy_test2.xpi", xpi2);
|
server.registerFile("/data/policy_test2.xpi", xpi2);
|
||||||
|
|
||||||
|
let extension = ExtensionTestUtils.expectExtension(id);
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
AddonTestUtils.promiseInstallEvent("onInstallEnded"),
|
extension.awaitStartup(),
|
||||||
setupPolicyEngineWithJson({
|
setupPolicyEngineWithJson({
|
||||||
policies: {
|
policies: {
|
||||||
ExtensionSettings: {
|
ExtensionSettings: {
|
||||||
|
@ -128,8 +134,9 @@ add_task(async function test_newurl_addon_update() {
|
||||||
notEqual(addon, null, "Addon should not be null");
|
notEqual(addon, null, "Addon should not be null");
|
||||||
equal(addon.version, "1.0", "Addon 1.0 installed");
|
equal(addon.version, "1.0", "Addon 1.0 installed");
|
||||||
|
|
||||||
|
extension = ExtensionTestUtils.expectExtension(id);
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
AddonTestUtils.promiseInstallEvent("onInstallEnded"),
|
extension.awaitStartup(),
|
||||||
setupPolicyEngineWithJson({
|
setupPolicyEngineWithJson({
|
||||||
policies: {
|
policies: {
|
||||||
ExtensionSettings: {
|
ExtensionSettings: {
|
||||||
|
@ -144,4 +151,6 @@ add_task(async function test_newurl_addon_update() {
|
||||||
|
|
||||||
addon = await AddonManager.getAddonByID(id);
|
addon = await AddonManager.getAddonByID(id);
|
||||||
equal(addon.version, "2.0", "Addon 2.0 installed");
|
equal(addon.version, "2.0", "Addon 2.0 installed");
|
||||||
|
|
||||||
|
await AddonTestUtils.promiseShutdownManager();
|
||||||
});
|
});
|
||||||
|
|
Загрузка…
Ссылка в новой задаче