dom/apps/tests/unit/test_manifestSanitizer.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial