diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/apps/tests/unit/test_moziapplication.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/apps/tests/unit/test_moziapplication.js')
-rw-r--r-- | dom/apps/tests/unit/test_moziapplication.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/dom/apps/tests/unit/test_moziapplication.js b/dom/apps/tests/unit/test_moziapplication.js new file mode 100644 index 000000000..dbcf2372a --- /dev/null +++ b/dom/apps/tests/unit/test_moziapplication.js @@ -0,0 +1,64 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +var {classes: Cc, interfaces: Ci, utils: Cu} = Components; + +Cu.import("resource:///modules/AppsUtils.jsm"); + +add_test(() => { + let app = { + name: "TestApp", + csp: "aCsp", + installOrigin: "http://installorigin.com", + origin: "http://www.example.com", + installTime: Date.now(), + manifestURL: "http://www.example.com/manifest.webapp", + appStatus: Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED, + removable: false, + id: 123, + localId: 123, + basePath: "/", + progress: 1.0, + installState: "installed", + downloadAvailable: false, + downloading: false, + lastUpdateCheck: Date.now(), + updateTime: Date.now(), + etag: "aEtag", + packageEtag: "aPackageEtag", + manifestHash: "aManifestHash", + packageHash: "aPackageHash", + staged: false, + installerAppId: 345, + installerIsBrowser: false, + storeId: "aStoreId", + storeVersion: 1, + role: "aRole", + kind: "aKind", + enabled: true, + sideloaded: false + }; + + let mozapp = new mozIApplication(app); + + Object.keys(app).forEach((key) => { + if (key == "principal") { + return; + } + Assert.equal(app[key], mozapp[key], + "app[" + key + "] should be equal to mozapp[" + key + "]"); + }); + + Assert.ok(mozapp.principal, "app principal should exist"); + let expectedPrincipalOrigin = app.origin + "^appId=" + app.localId; + Assert.equal(mozapp.principal.origin, expectedPrincipalOrigin, + "app principal origin ok"); + Assert.equal(mozapp.principal.appId, app.localId, "app principal appId ok"); + Assert.equal(mozapp.principal.isInIsolatedMozBrowserElement, false, + "app principal isInIsolatedMozBrowserElement ok"); + run_next_test(); +}); + +function run_test() { + run_next_test(); +} |