1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug470377_3.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,95 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.7 + */ 1.8 + 1.9 +Services.prefs.setBoolPref(PREF_EM_STRICT_COMPATIBILITY, false); 1.10 + 1.11 +function run_test() { 1.12 + do_test_pending(); 1.13 + createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "2.2.3", "2"); 1.14 + 1.15 + // inject the add-ons into the profile 1.16 + var dest = gProfD.clone(); 1.17 + dest.append("extensions"); 1.18 + dest.append("bug470377_1@tests.mozilla.org"); 1.19 + dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); 1.20 + var source = do_get_file("data/test_bug470377/install_1.rdf"); 1.21 + source.copyTo(dest, "install.rdf"); 1.22 + dest = gProfD.clone(); 1.23 + dest.append("extensions"); 1.24 + dest.append("bug470377_2@tests.mozilla.org"); 1.25 + dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); 1.26 + source = do_get_file("data/test_bug470377/install_2.rdf"); 1.27 + source.copyTo(dest, "install.rdf"); 1.28 + dest = gProfD.clone(); 1.29 + dest.append("extensions"); 1.30 + dest.append("bug470377_3@tests.mozilla.org"); 1.31 + dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); 1.32 + source = do_get_file("data/test_bug470377/install_3.rdf"); 1.33 + source.copyTo(dest, "install.rdf"); 1.34 + dest = gProfD.clone(); 1.35 + dest.append("extensions"); 1.36 + dest.append("bug470377_4@tests.mozilla.org"); 1.37 + dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); 1.38 + source = do_get_file("data/test_bug470377/install_4.rdf"); 1.39 + source.copyTo(dest, "install.rdf"); 1.40 + dest = gProfD.clone(); 1.41 + dest.append("extensions"); 1.42 + dest.append("bug470377_5@tests.mozilla.org"); 1.43 + dest.create(Components.interfaces.nsIFile.DIRECTORY_TYPE, 0755); 1.44 + source = do_get_file("data/test_bug470377/install_5.rdf"); 1.45 + source.copyTo(dest, "install.rdf"); 1.46 + 1.47 + startupManager(); 1.48 + 1.49 + run_test_1(); 1.50 +} 1.51 + 1.52 +function run_test_1() { 1.53 + AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org", 1.54 + "bug470377_2@tests.mozilla.org", 1.55 + "bug470377_3@tests.mozilla.org", 1.56 + "bug470377_4@tests.mozilla.org", 1.57 + "bug470377_5@tests.mozilla.org"], 1.58 + function([a1, a2, a3, a4, a5]) { 1.59 + do_check_neq(a1, null); 1.60 + do_check_false(a1.isActive); 1.61 + do_check_neq(a2, null); 1.62 + do_check_true(a2.isActive); 1.63 + do_check_neq(a3, null); 1.64 + do_check_true(a3.isActive); 1.65 + do_check_neq(a4, null); 1.66 + do_check_true(a4.isActive); 1.67 + do_check_neq(a5, null); 1.68 + do_check_true(a5.isActive); 1.69 + 1.70 + do_execute_soon(run_test_2); 1.71 + }); 1.72 +} 1.73 + 1.74 +function run_test_2() { 1.75 + AddonManager.checkCompatibility = false; 1.76 + 1.77 + restartManager(); 1.78 + 1.79 + AddonManager.getAddonsByIDs(["bug470377_1@tests.mozilla.org", 1.80 + "bug470377_2@tests.mozilla.org", 1.81 + "bug470377_3@tests.mozilla.org", 1.82 + "bug470377_4@tests.mozilla.org", 1.83 + "bug470377_5@tests.mozilla.org"], 1.84 + function([a1, a2, a3, a4, a5]) { 1.85 + do_check_neq(a1, null); 1.86 + do_check_false(a1.isActive); 1.87 + do_check_neq(a2, null); 1.88 + do_check_true(a2.isActive); 1.89 + do_check_neq(a3, null); 1.90 + do_check_true(a3.isActive); 1.91 + do_check_neq(a4, null); 1.92 + do_check_true(a4.isActive); 1.93 + do_check_neq(a5, null); 1.94 + do_check_true(a5.isActive); 1.95 + 1.96 + do_execute_soon(do_test_finished); 1.97 + }); 1.98 +}