fune/devtools/server/tests/mochitest/test_device.html
Fabien Casters 7b53fcdbb6 Bug 1325988 - Fix ESLint issues in devtools/server/tests/mochitest/ r=tromey
MozReview-Commit-ID: BFaOv5i5Tun

--HG--
extra : rebase_source : 5c2b5d1867eb5b48c56725b87d71dae72a83eb34
2017-03-13 21:15:44 +01:00

92 lines
2.8 KiB
HTML

<!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>
"use strict";
window.onload = function () {
const Cu = Components.utils;
const Cc = Components.classes;
const Ci = Components.interfaces;
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
const {DebuggerClient} = require("devtools/shared/client/main");
const {DebuggerServer} = require("devtools/server/main");
const Services = require("Services");
SimpleTest.waitForExplicitFinish();
const {getDeviceFront} = require("devtools/shared/fronts/device");
if (!DebuggerServer.initialized) {
DebuggerServer.init();
DebuggerServer.addBrowserActors();
}
let client = new DebuggerClient(DebuggerServer.connectPipe());
client.connect().then(function onConnect() {
client.listTabs(function onListTabs(response) {
let d = getDeviceFront(client, response);
let desc;
let appInfo = Services.appinfo;
let utils = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let 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 (let key in localDesc) {
is(desc[key], localDesc[key], "valid field (" + key + ")");
}
let currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
let profileDir = currProfD.path;
ok(profileDir.indexOf(desc.profile.length > 0 && desc.profile) != -1,
"valid profile name");
client.close().then(() => {
DebuggerServer.destroy();
SimpleTest.finish();
});
}
d.getDescription().then(function (v) {
desc = v;
}).then(checkValues);
});
});
};
</script>
</pre>
</body>
</html>