Bug 1447903: Part 10b - Update test_cacheflush.js to only test restartless add-ons. r?aswan
MozReview-Commit-ID: ETkjchlZu2k
--- a/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/head_addons.js
@@ -75,17 +75,16 @@ const LEGACY_NON_RESTARTLESS_TESTS = new
"test_bug397778.js",
"test_bug425657.js",
"test_bug455906.js",
"test_bug470377_1.js",
"test_bug470377_2.js",
"test_bug470377_3.js",
"test_bug470377_4.js",
"test_bug655254.js",
- "test_cacheflush.js",
"test_checkcompatibility.js",
"test_signed_verify.js",
"test_strictcompatibility.js",
"test_syncGUID.js",
"test_upgrade.js",
]);
if (LEGACY_NON_RESTARTLESS_TESTS.has(_TEST_FILE[0].replace(/.*\//, ""))) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_cacheflush.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_cacheflush.js
@@ -19,26 +19,16 @@ var CacheFlushObserver = {
ok(aSubject instanceof AM_Ci.nsIFile);
equal(aSubject.path, gExpectedFile.path);
gCacheFlushCount++;
}
};
const ADDONS = [
{
- id: "addon1@tests.mozilla.org",
- version: "2.0",
- name: "Cache Flush Test",
-
- targetApplications: [{
- id: "xpcshell@tests.mozilla.org",
- minVersion: "1",
- maxVersion: "1" }],
- },
- {
id: "addon2@tests.mozilla.org",
version: "2.0",
name: "Cache Flush Test",
bootstrap: true,
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
@@ -51,69 +41,19 @@ const XPIS = ADDONS.map(addon => createT
add_task(async function setup() {
Services.obs.addObserver(CacheFlushObserver, "flush-cache-entry");
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "2");
await promiseStartupManager();
});
-// Tests that the cache is flushed when cancelling a pending install
-add_task(async function test_flush_pending_install() {
- let install = await AddonManager.getInstallForFile(XPIS[0]);
- await promiseCompleteInstall(install);
-
- // We should flush the staged XPI when cancelling the install
- gExpectedFile = gProfD.clone();
- gExpectedFile.append("extensions");
- gExpectedFile.append("staged");
- gExpectedFile.append("addon1@tests.mozilla.org.xpi");
- install.cancel();
-
- equal(gCacheFlushCount, 1);
- gExpectedFile = null;
- gCacheFlushCount = 0;
-});
-
-// Tests that the cache is flushed when uninstalling an add-on
-add_task(async function test_flush_uninstall() {
- await promiseInstallFile(XPIS[0]);
-
- // Installing will flush the staged XPI during startup
- gExpectedFile = gProfD.clone();
- gExpectedFile.append("extensions");
- gExpectedFile.append("staged");
- gExpectedFile.append("addon1@tests.mozilla.org.xpi");
-
- await promiseRestartManager();
-
- equal(gCacheFlushCount, 1);
- gExpectedFile = null;
- gCacheFlushCount = 0;
-
- let addon = await AddonManager.getAddonByID("addon1@tests.mozilla.org");
- // We should flush the installed XPI when uninstalling
- ok(addon != null);
- addon.uninstall();
- equal(gCacheFlushCount, 0);
-
- gExpectedFile = gProfD.clone();
- gExpectedFile.append("extensions");
- gExpectedFile.append("addon1@tests.mozilla.org.xpi");
-
- await promiseRestartManager();
-
- equal(gCacheFlushCount, 1);
- gExpectedFile = null;
- gCacheFlushCount = 0;
-});
-
// Tests that the cache is flushed when installing a restartless add-on
add_task(async function test_flush_restartless_install() {
- let install = await AddonManager.getInstallForFile(XPIS[1]);
+ let install = await AddonManager.getInstallForFile(XPIS[0]);
await new Promise(resolve => {
install.addListener({
onInstallStarted() {
// We should flush the staged XPI when completing the install
gExpectedFile = gProfD.clone();
gExpectedFile.append("extensions");
gExpectedFile.append("staged");