toolkit/mozapps/extensions/test/browser/browser_bug557956.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 * http://creativecommons.org/publicdomain/zero/1.0/
michael@0 3 */
michael@0 4
michael@0 5 // Test the compatibility dialog that displays during startup when the browser
michael@0 6 // version changes.
michael@0 7
michael@0 8 const URI_EXTENSION_UPDATE_DIALOG = "chrome://mozapps/content/extensions/update.xul";
michael@0 9
michael@0 10 const PREF_GETADDONS_BYIDS = "extensions.getAddons.get.url";
michael@0 11 const PREF_MIN_PLATFORM_COMPAT = "extensions.minCompatiblePlatformVersion";
michael@0 12
michael@0 13 Services.prefs.setBoolPref(PREF_STRICT_COMPAT, true);
michael@0 14 // avoid the 'leaked window property' check
michael@0 15 let scope = {};
michael@0 16 Components.utils.import("resource://gre/modules/TelemetryPing.jsm", scope);
michael@0 17 let TelemetryPing = scope.TelemetryPing;
michael@0 18
michael@0 19 /**
michael@0 20 * Test add-ons:
michael@0 21 *
michael@0 22 * Addon minVersion maxVersion Notes
michael@0 23 * addon1 0 *
michael@0 24 * addon2 0 0
michael@0 25 * addon3 0 0
michael@0 26 * addon4 1 *
michael@0 27 * addon5 0 0 Made compatible by update check
michael@0 28 * addon6 0 0 Made compatible by update check
michael@0 29 * addon7 0 0 Has a broken update available
michael@0 30 * addon8 0 0 Has an update available
michael@0 31 * addon9 0 0 Has an update available
michael@0 32 */
michael@0 33
michael@0 34 function test() {
michael@0 35 requestLongerTimeout(2);
michael@0 36 waitForExplicitFinish();
michael@0 37
michael@0 38 run_next_test();
michael@0 39 }
michael@0 40
michael@0 41 function end_test() {
michael@0 42 // Test generates a lot of available installs so just cancel them all
michael@0 43 AddonManager.getAllInstalls(function(aInstalls) {
michael@0 44 for (let install of aInstalls)
michael@0 45 install.cancel();
michael@0 46
michael@0 47 finish();
michael@0 48 });
michael@0 49 }
michael@0 50
michael@0 51 function install_test_addons(aCallback) {
michael@0 52 var installs = [];
michael@0 53
michael@0 54 // Use a blank update URL
michael@0 55 Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
michael@0 56
michael@0 57 let names = ["browser_bug557956_1",
michael@0 58 "browser_bug557956_2",
michael@0 59 "browser_bug557956_3",
michael@0 60 "browser_bug557956_4",
michael@0 61 "browser_bug557956_5",
michael@0 62 "browser_bug557956_6",
michael@0 63 "browser_bug557956_7",
michael@0 64 "browser_bug557956_8_1",
michael@0 65 "browser_bug557956_9_1",
michael@0 66 "browser_bug557956_10"];
michael@0 67 for (let name of names) {
michael@0 68 AddonManager.getInstallForURL(TESTROOT + "addons/" + name + ".xpi", function(aInstall) {
michael@0 69 installs.push(aInstall);
michael@0 70 }, "application/x-xpinstall");
michael@0 71 }
michael@0 72
michael@0 73 var listener = {
michael@0 74 installCount: 0,
michael@0 75
michael@0 76 onInstallEnded: function() {
michael@0 77 this.installCount++;
michael@0 78 if (this.installCount == installs.length) {
michael@0 79 // Switch to the test update URL
michael@0 80 Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "browser_bug557956.rdf");
michael@0 81
michael@0 82 aCallback();
michael@0 83 }
michael@0 84 }
michael@0 85 };
michael@0 86
michael@0 87 for (let install of installs) {
michael@0 88 install.addListener(listener);
michael@0 89 install.install();
michael@0 90 }
michael@0 91 }
michael@0 92
michael@0 93 function uninstall_test_addons(aCallback) {
michael@0 94 AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
michael@0 95 "addon2@tests.mozilla.org",
michael@0 96 "addon3@tests.mozilla.org",
michael@0 97 "addon4@tests.mozilla.org",
michael@0 98 "addon5@tests.mozilla.org",
michael@0 99 "addon6@tests.mozilla.org",
michael@0 100 "addon7@tests.mozilla.org",
michael@0 101 "addon8@tests.mozilla.org",
michael@0 102 "addon9@tests.mozilla.org",
michael@0 103 "addon10@tests.mozilla.org"],
michael@0 104 function(aAddons) {
michael@0 105 for (let addon of aAddons) {
michael@0 106 if (addon)
michael@0 107 addon.uninstall();
michael@0 108 }
michael@0 109 aCallback();
michael@0 110 });
michael@0 111 }
michael@0 112
michael@0 113 function open_compatibility_window(aInactiveAddonIds, aCallback) {
michael@0 114 // This will reset the longer timeout multiplier to 2 which will give each
michael@0 115 // test that calls open_compatibility_window a minimum of 60 seconds to
michael@0 116 // complete.
michael@0 117 requestLongerTimeout(2);
michael@0 118
michael@0 119 var variant = Cc["@mozilla.org/variant;1"].
michael@0 120 createInstance(Ci.nsIWritableVariant);
michael@0 121 variant.setFromVariant(aInactiveAddonIds);
michael@0 122
michael@0 123 // Cannot be modal as we want to interract with it, shouldn't cause problems
michael@0 124 // with testing though.
michael@0 125 var features = "chrome,centerscreen,dialog,titlebar";
michael@0 126 var ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
michael@0 127 getService(Ci.nsIWindowWatcher);
michael@0 128 var win = ww.openWindow(null, URI_EXTENSION_UPDATE_DIALOG, "", features, variant);
michael@0 129
michael@0 130 win.addEventListener("load", function() {
michael@0 131 win.removeEventListener("load", arguments.callee, false);
michael@0 132
michael@0 133 info("Compatibility dialog opened");
michael@0 134
michael@0 135 function page_shown(aEvent) {
michael@0 136 if (aEvent.target.pageid)
michael@0 137 info("Page " + aEvent.target.pageid + " shown");
michael@0 138 }
michael@0 139
michael@0 140 win.addEventListener("pageshow", page_shown, false);
michael@0 141 win.addEventListener("unload", function() {
michael@0 142 win.removeEventListener("unload", arguments.callee, false);
michael@0 143 win.removeEventListener("pageshow", page_shown, false);
michael@0 144 info("Compatibility dialog closed");
michael@0 145 }, false);
michael@0 146
michael@0 147 aCallback(win);
michael@0 148 }, false);
michael@0 149 }
michael@0 150
michael@0 151 function wait_for_window_close(aWindow, aCallback) {
michael@0 152 aWindow.addEventListener("unload", function() {
michael@0 153 aWindow.removeEventListener("unload", arguments.callee, false);
michael@0 154 aCallback();
michael@0 155 }, false);
michael@0 156 }
michael@0 157
michael@0 158 function wait_for_page(aWindow, aPageId, aCallback) {
michael@0 159 var page = aWindow.document.getElementById(aPageId);
michael@0 160 page.addEventListener("pageshow", function() {
michael@0 161 page.removeEventListener("pageshow", arguments.callee, false);
michael@0 162 executeSoon(function() {
michael@0 163 aCallback(aWindow);
michael@0 164 });
michael@0 165 }, false);
michael@0 166 }
michael@0 167
michael@0 168 function get_list_names(aList) {
michael@0 169 var items = [];
michael@0 170 for (let listItem of aList.childNodes)
michael@0 171 items.push(listItem.label);
michael@0 172 items.sort();
michael@0 173 return items;
michael@0 174 }
michael@0 175
michael@0 176 function check_telemetry({disabled, metaenabled, metadisabled, upgraded, failed, declined}) {
michael@0 177 let ping = TelemetryPing.getPayload();
michael@0 178 // info(JSON.stringify(ping));
michael@0 179 let am = ping.simpleMeasurements.addonManager;
michael@0 180 if (disabled !== undefined)
michael@0 181 is(am.appUpdate_disabled, disabled, disabled + " add-ons disabled by version change");
michael@0 182 if (metaenabled !== undefined)
michael@0 183 is(am.appUpdate_metadata_enabled, metaenabled, metaenabled + " add-ons enabled by metadata");
michael@0 184 if (metadisabled !== undefined)
michael@0 185 is(am.appUpdate_metadata_disabled, metadisabled, metadisabled + " add-ons disabled by metadata");
michael@0 186 if (upgraded !== undefined)
michael@0 187 is(am.appUpdate_upgraded, upgraded, upgraded + " add-ons upgraded");
michael@0 188 if (failed !== undefined)
michael@0 189 is(am.appUpdate_upgradeFailed, failed, failed + " upgrades failed");
michael@0 190 if (declined !== undefined)
michael@0 191 is(am.appUpdate_upgradeDeclined, declined, declined + " upgrades declined");
michael@0 192 }
michael@0 193
michael@0 194 // Tests that the right add-ons show up in the mismatch dialog and updates can
michael@0 195 // be installed
michael@0 196 add_test(function() {
michael@0 197 install_test_addons(function() {
michael@0 198 // These add-ons were inactive in the old application
michael@0 199 var inactiveAddonIds = [
michael@0 200 "addon2@tests.mozilla.org",
michael@0 201 "addon4@tests.mozilla.org",
michael@0 202 "addon5@tests.mozilla.org",
michael@0 203 "addon10@tests.mozilla.org"
michael@0 204 ];
michael@0 205
michael@0 206 AddonManager.getAddonsByIDs(["addon5@tests.mozilla.org",
michael@0 207 "addon6@tests.mozilla.org"],
michael@0 208 function([a5, a6]) {
michael@0 209 // Check starting (pre-update) conditions
michael@0 210 ok(!a5.isCompatible, "addon5 should not be compatible");
michael@0 211 ok(!a6.isCompatible, "addon6 should not be compatible");
michael@0 212
michael@0 213 open_compatibility_window(inactiveAddonIds, function(aWindow) {
michael@0 214 var doc = aWindow.document;
michael@0 215 wait_for_page(aWindow, "mismatch", function(aWindow) {
michael@0 216 var items = get_list_names(doc.getElementById("mismatch.incompatible"));
michael@0 217 // Check that compatibility updates from individual add-on update checks were applied.
michael@0 218 is(items.length, 4, "Should have seen 4 still incompatible items");
michael@0 219 is(items[0], "Addon3 1.0", "Should have seen addon3 still incompatible");
michael@0 220 is(items[1], "Addon7 1.0", "Should have seen addon7 still incompatible");
michael@0 221 is(items[2], "Addon8 1.0", "Should have seen addon8 still incompatible");
michael@0 222 is(items[3], "Addon9 1.0", "Should have seen addon9 still incompatible");
michael@0 223
michael@0 224 ok(a5.isCompatible, "addon5 should be compatible");
michael@0 225 ok(a6.isCompatible, "addon6 should be compatible");
michael@0 226
michael@0 227 var button = doc.documentElement.getButton("next");
michael@0 228 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 229
michael@0 230 wait_for_page(aWindow, "found", function(aWindow) {
michael@0 231 ok(doc.getElementById("xpinstallDisabledAlert").hidden,
michael@0 232 "Install should be allowed");
michael@0 233
michael@0 234 var list = doc.getElementById("found.updates");
michael@0 235 var items = get_list_names(list);
michael@0 236 is(items.length, 3, "Should have seen 3 updates available");
michael@0 237 is(items[0], "Addon7 2.0", "Should have seen update for addon7");
michael@0 238 is(items[1], "Addon8 2.0", "Should have seen update for addon8");
michael@0 239 is(items[2], "Addon9 2.0", "Should have seen update for addon9");
michael@0 240
michael@0 241 ok(!doc.documentElement.getButton("next").disabled,
michael@0 242 "Next button should be enabled");
michael@0 243
michael@0 244 // Uncheck all
michael@0 245 for (let listItem of list.childNodes)
michael@0 246 EventUtils.synthesizeMouse(listItem, 2, 2, { }, aWindow);
michael@0 247
michael@0 248 ok(doc.documentElement.getButton("next").disabled,
michael@0 249 "Next button should not be enabled");
michael@0 250
michael@0 251 // Check the ones we want to install
michael@0 252 for (let listItem of list.childNodes) {
michael@0 253 if (listItem.label != "Addon7 2.0")
michael@0 254 EventUtils.synthesizeMouse(listItem, 2, 2, { }, aWindow);
michael@0 255 }
michael@0 256
michael@0 257 var button = doc.documentElement.getButton("next");
michael@0 258 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 259
michael@0 260 wait_for_page(aWindow, "finished", function(aWindow) {
michael@0 261 var button = doc.documentElement.getButton("finish");
michael@0 262 ok(!button.hidden, "Finish button should not be hidden");
michael@0 263 ok(!button.disabled, "Finish button should not be disabled");
michael@0 264 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 265
michael@0 266 wait_for_window_close(aWindow, function() {
michael@0 267 AddonManager.getAddonsByIDs(["addon8@tests.mozilla.org",
michael@0 268 "addon9@tests.mozilla.org"],
michael@0 269 function([a8, a9]) {
michael@0 270 is(a8.version, "2.0", "addon8 should have updated");
michael@0 271 is(a9.version, "2.0", "addon9 should have updated");
michael@0 272
michael@0 273 check_telemetry({disabled: 4, metaenabled: 2, metadisabled: 0,
michael@0 274 upgraded: 2, failed: 0, declined: 1});
michael@0 275
michael@0 276 uninstall_test_addons(run_next_test);
michael@0 277 });
michael@0 278 });
michael@0 279 });
michael@0 280 });
michael@0 281 });
michael@0 282 });
michael@0 283 });
michael@0 284 });
michael@0 285 });
michael@0 286
michael@0 287 // Tests that the install failures show the install failed page and disabling
michael@0 288 // xpinstall shows the right UI.
michael@0 289 add_test(function() {
michael@0 290 install_test_addons(function() {
michael@0 291 // These add-ons were inactive in the old application
michael@0 292 var inactiveAddonIds = [
michael@0 293 "addon2@tests.mozilla.org",
michael@0 294 "addon4@tests.mozilla.org",
michael@0 295 "addon5@tests.mozilla.org",
michael@0 296 "addon10@tests.mozilla.org"
michael@0 297 ];
michael@0 298
michael@0 299 Services.prefs.setBoolPref("xpinstall.enabled", false);
michael@0 300
michael@0 301 open_compatibility_window(inactiveAddonIds, function(aWindow) {
michael@0 302 var doc = aWindow.document;
michael@0 303 wait_for_page(aWindow, "mismatch", function(aWindow) {
michael@0 304 var items = get_list_names(doc.getElementById("mismatch.incompatible"));
michael@0 305 is(items.length, 4, "Should have seen 4 still incompatible items");
michael@0 306 is(items[0], "Addon3 1.0", "Should have seen addon3 still incompatible");
michael@0 307 is(items[1], "Addon7 1.0", "Should have seen addon7 still incompatible");
michael@0 308 is(items[2], "Addon8 1.0", "Should have seen addon8 still incompatible");
michael@0 309 is(items[3], "Addon9 1.0", "Should have seen addon9 still incompatible");
michael@0 310
michael@0 311 // Check that compatibility updates were applied.
michael@0 312 AddonManager.getAddonsByIDs(["addon5@tests.mozilla.org",
michael@0 313 "addon6@tests.mozilla.org"],
michael@0 314 function([a5, a6]) {
michael@0 315 ok(a5.isCompatible, "addon5 should be compatible");
michael@0 316 ok(a6.isCompatible, "addon6 should be compatible");
michael@0 317
michael@0 318 var button = doc.documentElement.getButton("next");
michael@0 319 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 320
michael@0 321 wait_for_page(aWindow, "found", function(aWindow) {
michael@0 322 ok(!doc.getElementById("xpinstallDisabledAlert").hidden,
michael@0 323 "Install should not be allowed");
michael@0 324
michael@0 325 ok(doc.documentElement.getButton("next").disabled,
michael@0 326 "Next button should be disabled");
michael@0 327
michael@0 328 var checkbox = doc.getElementById("enableXPInstall");
michael@0 329 EventUtils.synthesizeMouse(checkbox, 2, 2, { }, aWindow);
michael@0 330
michael@0 331 ok(!doc.documentElement.getButton("next").disabled,
michael@0 332 "Next button should be enabled");
michael@0 333
michael@0 334 var list = doc.getElementById("found.updates");
michael@0 335 var items = get_list_names(list);
michael@0 336 is(items.length, 3, "Should have seen 3 updates available");
michael@0 337 is(items[0], "Addon7 2.0", "Should have seen update for addon7");
michael@0 338 is(items[1], "Addon8 2.0", "Should have seen update for addon8");
michael@0 339 is(items[2], "Addon9 2.0", "Should have seen update for addon9");
michael@0 340
michael@0 341 // Unheck the ones we don't want to install
michael@0 342 for (let listItem of list.childNodes) {
michael@0 343 if (listItem.label != "Addon7 2.0")
michael@0 344 EventUtils.synthesizeMouse(listItem, 2, 2, { }, aWindow);
michael@0 345 }
michael@0 346
michael@0 347 var button = doc.documentElement.getButton("next");
michael@0 348 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 349
michael@0 350 wait_for_page(aWindow, "installerrors", function(aWindow) {
michael@0 351 var button = doc.documentElement.getButton("finish");
michael@0 352 ok(!button.hidden, "Finish button should not be hidden");
michael@0 353 ok(!button.disabled, "Finish button should not be disabled");
michael@0 354
michael@0 355 wait_for_window_close(aWindow, function() {
michael@0 356 uninstall_test_addons(run_next_test);
michael@0 357 });
michael@0 358
michael@0 359 check_telemetry({disabled: 4, metaenabled: 2, metadisabled: 0,
michael@0 360 upgraded: 0, failed: 1, declined: 2});
michael@0 361
michael@0 362 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 363 });
michael@0 364 });
michael@0 365 });
michael@0 366 });
michael@0 367 });
michael@0 368 });
michael@0 369 });
michael@0 370
michael@0 371 // Tests that no add-ons show up in the mismatch dialog when they are all disabled
michael@0 372 add_test(function() {
michael@0 373 install_test_addons(function() {
michael@0 374 AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
michael@0 375 "addon2@tests.mozilla.org",
michael@0 376 "addon3@tests.mozilla.org",
michael@0 377 "addon4@tests.mozilla.org",
michael@0 378 "addon5@tests.mozilla.org",
michael@0 379 "addon6@tests.mozilla.org",
michael@0 380 "addon7@tests.mozilla.org",
michael@0 381 "addon8@tests.mozilla.org",
michael@0 382 "addon9@tests.mozilla.org",
michael@0 383 "addon10@tests.mozilla.org"],
michael@0 384 function(aAddons) {
michael@0 385 for (let addon of aAddons)
michael@0 386 addon.userDisabled = true;
michael@0 387
michael@0 388 // These add-ons were inactive in the old application
michael@0 389 var inactiveAddonIds = [
michael@0 390 "addon1@tests.mozilla.org",
michael@0 391 "addon2@tests.mozilla.org",
michael@0 392 "addon3@tests.mozilla.org",
michael@0 393 "addon4@tests.mozilla.org",
michael@0 394 "addon5@tests.mozilla.org",
michael@0 395 "addon6@tests.mozilla.org",
michael@0 396 "addon7@tests.mozilla.org",
michael@0 397 "addon8@tests.mozilla.org",
michael@0 398 "addon9@tests.mozilla.org",
michael@0 399 "addon10@tests.mozilla.org"
michael@0 400 ];
michael@0 401
michael@0 402 open_compatibility_window(inactiveAddonIds, function(aWindow) {
michael@0 403 // Should close immediately on its own
michael@0 404 wait_for_window_close(aWindow, function() {
michael@0 405 uninstall_test_addons(run_next_test);
michael@0 406 });
michael@0 407 });
michael@0 408 });
michael@0 409 });
michael@0 410 });
michael@0 411
michael@0 412 // Tests that the right UI shows for when no updates are available
michael@0 413 add_test(function() {
michael@0 414 install_test_addons(function() {
michael@0 415 AddonManager.getAddonsByIDs(["addon7@tests.mozilla.org",
michael@0 416 "addon8@tests.mozilla.org",
michael@0 417 "addon9@tests.mozilla.org",
michael@0 418 "addon10@tests.mozilla.org"],
michael@0 419 function(aAddons) {
michael@0 420 for (let addon of aAddons)
michael@0 421 addon.uninstall();
michael@0 422
michael@0 423 // These add-ons were inactive in the old application
michael@0 424 var inactiveAddonIds = [
michael@0 425 "addon2@tests.mozilla.org",
michael@0 426 "addon4@tests.mozilla.org",
michael@0 427 "addon5@tests.mozilla.org"
michael@0 428 ];
michael@0 429
michael@0 430 open_compatibility_window(inactiveAddonIds, function(aWindow) {
michael@0 431 var doc = aWindow.document;
michael@0 432 wait_for_page(aWindow, "mismatch", function(aWindow) {
michael@0 433 var items = get_list_names(doc.getElementById("mismatch.incompatible"));
michael@0 434 is(items.length, 1, "Should have seen 1 still incompatible items");
michael@0 435 is(items[0], "Addon3 1.0", "Should have seen addon3 still incompatible");
michael@0 436
michael@0 437 var button = doc.documentElement.getButton("next");
michael@0 438 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 439
michael@0 440 wait_for_page(aWindow, "noupdates", function(aWindow) {
michael@0 441 var button = doc.documentElement.getButton("finish");
michael@0 442 ok(!button.hidden, "Finish button should not be hidden");
michael@0 443 ok(!button.disabled, "Finish button should not be disabled");
michael@0 444
michael@0 445 wait_for_window_close(aWindow, function() {
michael@0 446 uninstall_test_addons(run_next_test);
michael@0 447 });
michael@0 448
michael@0 449 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 450 });
michael@0 451 });
michael@0 452 });
michael@0 453 });
michael@0 454 });
michael@0 455 });
michael@0 456
michael@0 457 // Tests that compatibility overrides are retrieved and affect addon
michael@0 458 // compatibility.
michael@0 459 add_test(function() {
michael@0 460 Services.prefs.setBoolPref(PREF_STRICT_COMPAT, false);
michael@0 461 Services.prefs.setCharPref(PREF_MIN_PLATFORM_COMPAT, "0");
michael@0 462 is(AddonManager.strictCompatibility, false, "Strict compatibility should be disabled");
michael@0 463
michael@0 464 // Use a blank update URL
michael@0 465 Services.prefs.setCharPref(PREF_UPDATEURL, TESTROOT + "missing.rdf");
michael@0 466
michael@0 467 install_test_addons(function() {
michael@0 468
michael@0 469 AddonManager.getAddonsByIDs(["addon1@tests.mozilla.org",
michael@0 470 "addon2@tests.mozilla.org",
michael@0 471 "addon3@tests.mozilla.org",
michael@0 472 "addon4@tests.mozilla.org",
michael@0 473 "addon5@tests.mozilla.org",
michael@0 474 "addon6@tests.mozilla.org",
michael@0 475 "addon7@tests.mozilla.org",
michael@0 476 "addon8@tests.mozilla.org",
michael@0 477 "addon9@tests.mozilla.org",
michael@0 478 "addon10@tests.mozilla.org"],
michael@0 479 function(aAddons) {
michael@0 480
michael@0 481 for (let addon of aAddons) {
michael@0 482 if (addon.id == "addon10@tests.mozilla.org")
michael@0 483 is(addon.isCompatible, true, "Addon10 should be compatible before compat overrides are refreshed");
michael@0 484 else
michael@0 485 addon.uninstall();
michael@0 486 }
michael@0 487
michael@0 488 Services.prefs.setCharPref(PREF_GETADDONS_BYIDS, TESTROOT + "browser_bug557956.xml");
michael@0 489 Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
michael@0 490
michael@0 491 open_compatibility_window([], function(aWindow) {
michael@0 492 var doc = aWindow.document;
michael@0 493 wait_for_page(aWindow, "mismatch", function(aWindow) {
michael@0 494 var items = get_list_names(doc.getElementById("mismatch.incompatible"));
michael@0 495 is(items.length, 1, "Should have seen 1 incompatible item");
michael@0 496 is(items[0], "Addon10 1.0", "Should have seen addon10 as incompatible");
michael@0 497
michael@0 498 var button = doc.documentElement.getButton("next");
michael@0 499 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 500
michael@0 501 wait_for_page(aWindow, "noupdates", function(aWindow) {
michael@0 502 var button = doc.documentElement.getButton("finish");
michael@0 503 ok(!button.hidden, "Finish button should not be hidden");
michael@0 504 ok(!button.disabled, "Finish button should not be disabled");
michael@0 505
michael@0 506 wait_for_window_close(aWindow, function() {
michael@0 507 uninstall_test_addons(run_next_test);
michael@0 508 });
michael@0 509
michael@0 510 check_telemetry({disabled: 0, metaenabled: 0, metadisabled: 1,
michael@0 511 upgraded: 0, failed: 0, declined: 0});
michael@0 512
michael@0 513 EventUtils.synthesizeMouse(button, 2, 2, { }, aWindow);
michael@0 514 });
michael@0 515 });
michael@0 516 });
michael@0 517 });
michael@0 518 });
michael@0 519 });

mercurial