Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE html> |
michael@0 | 2 | |
michael@0 | 3 | <!-- |
michael@0 | 4 | Bug 907206 - data store for local apps |
michael@0 | 5 | --> |
michael@0 | 6 | |
michael@0 | 7 | <html> |
michael@0 | 8 | |
michael@0 | 9 | <head> |
michael@0 | 10 | <meta charset="utf8"> |
michael@0 | 11 | <title></title> |
michael@0 | 12 | |
michael@0 | 13 | <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 14 | <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> |
michael@0 | 15 | </head> |
michael@0 | 16 | |
michael@0 | 17 | <body> |
michael@0 | 18 | |
michael@0 | 19 | <script type="application/javascript;version=1.8"> |
michael@0 | 20 | const Cu = Components.utils; |
michael@0 | 21 | |
michael@0 | 22 | window.onload = function() { |
michael@0 | 23 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 24 | |
michael@0 | 25 | const {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}); |
michael@0 | 26 | const {require} = devtools; |
michael@0 | 27 | |
michael@0 | 28 | const { AppProjects } = require("devtools/app-manager/app-projects"); |
michael@0 | 29 | |
michael@0 | 30 | function testHosted(projects) { |
michael@0 | 31 | let manifestURL = document.location.href.replace("test_projects_store.html", "hosted_app/webapp.manifest"); |
michael@0 | 32 | AppProjects.addHosted(manifestURL) |
michael@0 | 33 | .then(function (app) { |
michael@0 | 34 | is(projects.length, 1, |
michael@0 | 35 | "Hosted app has been added"); |
michael@0 | 36 | is(projects[0], app); |
michael@0 | 37 | is(app.type, "hosted", "valid type"); |
michael@0 | 38 | is(app.location, manifestURL, "valid location"); |
michael@0 | 39 | is(AppProjects.get(manifestURL), app, |
michael@0 | 40 | "get() returns the same app object"); |
michael@0 | 41 | AppProjects.remove(manifestURL) |
michael@0 | 42 | .then(function () { |
michael@0 | 43 | is(projects.length, 0, |
michael@0 | 44 | "Hosted app has been removed"); |
michael@0 | 45 | SimpleTest.finish(); |
michael@0 | 46 | }); |
michael@0 | 47 | }); |
michael@0 | 48 | } |
michael@0 | 49 | |
michael@0 | 50 | AppProjects.once("ready", function (event, projects) { |
michael@0 | 51 | is(projects, AppProjects.store.object.projects, |
michael@0 | 52 | "The ready event data is the store projects list"); |
michael@0 | 53 | testHosted(projects); |
michael@0 | 54 | }); |
michael@0 | 55 | |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | </script> |
michael@0 | 59 | </body> |
michael@0 | 60 | </html> |