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 /devtools/server/tests/mochitest/test_device.html | |
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 'devtools/server/tests/mochitest/test_device.html')
-rw-r--r-- | devtools/server/tests/mochitest/test_device.html | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/devtools/server/tests/mochitest/test_device.html b/devtools/server/tests/mochitest/test_device.html new file mode 100644 index 000000000..d678f185f --- /dev/null +++ b/devtools/server/tests/mochitest/test_device.html @@ -0,0 +1,99 @@ +<!DOCTYPE HTML> +<html> +<!-- +Bug 895360 - [app manager] Device meta data actor +--> +<head> + <meta charset="utf-8"> + <title>Mozilla Bug</title> + <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"> +</head> +<body> +<pre id="test"> +<script> + +window.onload = function() { + var Cu = Components.utils; + var Cc = Components.classes; + var Ci = Components.interfaces; + + Cu.import("resource://gre/modules/PermissionsTable.jsm"); + var {require} = Cu.import("resource://devtools/shared/Loader.jsm", {}); + var {DebuggerClient} = require("devtools/shared/client/main"); + var {DebuggerServer} = require("devtools/server/main"); + var Services = require("Services"); + + SimpleTest.waitForExplicitFinish(); + + var {getDeviceFront} = require("devtools/shared/fronts/device"); + + if (!DebuggerServer.initialized) { + DebuggerServer.init(); + DebuggerServer.addBrowserActors(); + } + + var client = new DebuggerClient(DebuggerServer.connectPipe()); + client.connect().then(function onConnect() { + client.listTabs(function onListTabs(aResponse) { + var d = getDeviceFront(client, aResponse); + + var desc, permissions; + var appInfo = Services.appinfo; + var utils = window.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils); + + + var localDesc = { + appid: appInfo.ID, + vendor: appInfo.vendor, + name: appInfo.name, + version: appInfo.version, + appbuildid: appInfo.appBuildID, + platformbuildid: appInfo.platformBuildID, + platformversion: appInfo.platformVersion, + geckobuildid: appInfo.platformBuildID, + geckoversion: appInfo.platformVersion, + useragent: window.navigator.userAgent, + locale: Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global"), + os: appInfo.OS, + processor: appInfo.XPCOMABI.split("-")[0], + compiler: appInfo.XPCOMABI.split("-")[1], + dpi: utils.displayDPI, + width: window.screen.width, + height: window.screen.height + } + + function checkValues() { + for (var key in localDesc) { + is(desc[key], localDesc[key], "valid field (" + key + ")"); + } + + var currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile); + var profileDir = currProfD.path; + ok(profileDir.indexOf(desc.profile.length > 0 && desc.profile) != -1, "valid profile name"); + + var a = JSON.stringify(PermissionsTable); + var b = JSON.stringify(permissions.rawPermissionsTable); + + is(a, b, "Permissions Tables is valid"); + + client.close().then(() => { + DebuggerServer.destroy(); + SimpleTest.finish() + }); + } + + + d.getDescription().then((v) => desc = v) + .then(() => d.getRawPermissionsTable()) + .then((json) => permissions = json) + .then(checkValues); + + }); + }); + +} +</script> +</pre> +</body> +</html> |