dom/apps/tests/unit/test_manifestSanitizer.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 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