|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
3 */ |
|
4 |
|
5 // Bug 608316 - Test that opening the manager to an add-on that doesn't exist |
|
6 // just loads the default view |
|
7 |
|
8 var gCategoryUtilities; |
|
9 |
|
10 function test() { |
|
11 waitForExplicitFinish(); |
|
12 |
|
13 run_next_test(); |
|
14 } |
|
15 |
|
16 function end_test() { |
|
17 finish(); |
|
18 } |
|
19 |
|
20 add_test(function() { |
|
21 open_manager("addons://detail/foo", function(aManager) { |
|
22 gCategoryUtilities = new CategoryUtilities(aManager); |
|
23 is(gCategoryUtilities.selectedCategory, "discover", "Should fall back to the discovery pane"); |
|
24 |
|
25 close_manager(aManager, run_next_test); |
|
26 }); |
|
27 }); |
|
28 |
|
29 // Also test that opening directly to an add-on that does exist doesn't break |
|
30 // and selects the right category |
|
31 add_test(function() { |
|
32 new MockProvider().createAddons([{ |
|
33 id: "addon1@tests.mozilla.org", |
|
34 name: "addon 1", |
|
35 version: "1.0" |
|
36 }]); |
|
37 |
|
38 open_manager("addons://detail/addon1@tests.mozilla.org", function(aManager) { |
|
39 gCategoryUtilities = new CategoryUtilities(aManager); |
|
40 is(gCategoryUtilities.selectedCategory, "extension", "Should have selected the right category"); |
|
41 |
|
42 close_manager(aManager, run_next_test); |
|
43 }); |
|
44 }); |