|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function testEntryPoint(aRoot) { |
|
5 do_check_true(aRoot.name == "hello world"); |
|
6 do_check_true(aRoot.description == "A bold name"); |
|
7 do_check_true(aRoot.developer.name == "Blink Inc."); |
|
8 |
|
9 let permissions = aRoot.permissions; |
|
10 do_check_true(permissions.contacts.description == "Required for autocompletion in the share screen"); |
|
11 do_check_true(permissions.alarms.description == "Required to schedule notifications"); |
|
12 } |
|
13 |
|
14 function run_test() { |
|
15 Components.utils.import("resource:///modules/AppsUtils.jsm"); |
|
16 |
|
17 do_check_true(!!AppsUtils); |
|
18 |
|
19 // Test manifest, with one entry point. |
|
20 let manifest = { |
|
21 name: "hello <b>world</b>", |
|
22 description: "A bold name", |
|
23 developer: { |
|
24 name: "<blink>Blink</blink> Inc.", |
|
25 url: "http://blink.org" |
|
26 }, |
|
27 permissions : { |
|
28 "contacts": { |
|
29 "description": "Required for autocompletion in the <a href='http://shareme.com'>share</a> screen", |
|
30 "access": "readcreate" |
|
31 }, |
|
32 "alarms": { |
|
33 "description": "Required to schedule notifications" |
|
34 } |
|
35 }, |
|
36 |
|
37 entry_points: { |
|
38 "subapp": { |
|
39 name: "hello <b>world</b>", |
|
40 description: "A bold name", |
|
41 developer: { |
|
42 name: "<blink>Blink</blink> Inc.", |
|
43 url: "http://blink.org" |
|
44 }, |
|
45 permissions : { |
|
46 "contacts": { |
|
47 "description": "Required for autocompletion in the <a href='http://shareme.com'>share</a> screen", |
|
48 "access": "readcreate" |
|
49 }, |
|
50 "alarms": { |
|
51 "description": "Required to schedule notifications" |
|
52 } |
|
53 } |
|
54 } |
|
55 } |
|
56 } |
|
57 |
|
58 AppsUtils.sanitizeManifest(manifest); |
|
59 |
|
60 // Check the main section and the subapp entry point. |
|
61 testEntryPoint(manifest); |
|
62 testEntryPoint(manifest.entry_points.subapp); |
|
63 } |