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

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/mozapps/extensions/test/browser/browser_bug618502.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,44 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 + * http://creativecommons.org/publicdomain/zero/1.0/
     1.6 + */
     1.7 +
     1.8 +// Bug 608316 - Test that opening the manager to an add-on that doesn't exist
     1.9 +// just loads the default view
    1.10 +
    1.11 +var gCategoryUtilities;
    1.12 +
    1.13 +function test() {
    1.14 +  waitForExplicitFinish();
    1.15 +  
    1.16 +  run_next_test();
    1.17 +}
    1.18 +
    1.19 +function end_test() {
    1.20 +  finish();
    1.21 +}
    1.22 +
    1.23 +add_test(function() {
    1.24 +  open_manager("addons://detail/foo", function(aManager) {
    1.25 +    gCategoryUtilities = new CategoryUtilities(aManager);
    1.26 +    is(gCategoryUtilities.selectedCategory, "discover", "Should fall back to the discovery pane");
    1.27 +
    1.28 +    close_manager(aManager, run_next_test);
    1.29 +  });
    1.30 +});
    1.31 +
    1.32 +// Also test that opening directly to an add-on that does exist doesn't break
    1.33 +// and selects the right category
    1.34 +add_test(function() {
    1.35 +  new MockProvider().createAddons([{
    1.36 +    id: "addon1@tests.mozilla.org",
    1.37 +    name: "addon 1",
    1.38 +    version: "1.0"
    1.39 +  }]);
    1.40 +
    1.41 +  open_manager("addons://detail/addon1@tests.mozilla.org", function(aManager) {
    1.42 +    gCategoryUtilities = new CategoryUtilities(aManager);
    1.43 +    is(gCategoryUtilities.selectedCategory, "extension", "Should have selected the right category");
    1.44 +
    1.45 +    close_manager(aManager, run_next_test);
    1.46 +  });
    1.47 +});

mercurial