Bug 1931425 - Limit how often moz-label's #setStyles runs r=reusable-components-revie...
[gecko.git] / devtools / server / tests / chrome / test_device.html
blob117e50b5cac87dad33cb58226f9b0647fb7a9a93
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 Bug 895360 - [app manager] Device meta data actor
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Mozilla Bug</title>
9 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
11 </head>
12 <body>
13 <pre id="test">
14 <script>
15 "use strict";
17 window.onload = function() {
18 const {require} = ChromeUtils.importESModule("resource://devtools/shared/loader/Loader.sys.mjs");
19 const {DevToolsClient} = require("devtools/client/devtools-client");
20 const {DevToolsServer} = require("devtools/server/devtools-server");
22 SimpleTest.waitForExplicitFinish();
24 DevToolsServer.init();
25 DevToolsServer.registerAllActors();
27 const client = new DevToolsClient(DevToolsServer.connectPipe());
28 client.connect().then(function onConnect() {
29 return client.mainRoot.getFront("device");
30 }).then(function(d) {
31 let desc;
32 const appInfo = Services.appinfo;
33 const utils = window.windowUtils;
35 const localDesc = {
36 appid: appInfo.ID,
37 vendor: appInfo.vendor,
38 name: appInfo.name,
39 version: appInfo.version,
40 appbuildid: appInfo.appBuildID,
41 platformbuildid: appInfo.platformBuildID,
42 platformversion: appInfo.platformVersion,
43 geckobuildid: appInfo.platformBuildID,
44 geckoversion: appInfo.platformVersion,
45 useragent: window.navigator.userAgent,
46 locale: Services.locale.appLocaleAsBCP47,
47 os: appInfo.OS,
48 processor: appInfo.XPCOMABI.split("-")[0],
49 compiler: appInfo.XPCOMABI.split("-")[1],
50 dpi: utils.displayDPI,
51 width: window.screen.width,
52 height: window.screen.height,
55 function checkValues() {
56 for (const key in localDesc) {
57 is(desc[key], localDesc[key], "valid field (" + key + ")");
60 const currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
61 const profileDir = currProfD.path;
62 ok(profileDir.includes(!!desc.profile.length && desc.profile),
63 "valid profile name");
65 client.close().then(() => {
66 DevToolsServer.destroy();
67 SimpleTest.finish();
68 });
71 d.getDescription().then(function(v) {
72 desc = v;
73 }).then(checkValues);
74 });
76 </script>
77 </pre>
78 </body>
79 </html>