Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / extensions / test / data / system / display / test_display_api.js
blob901861017c7fc94471bba24a03977f363be98f89
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // system.display api test
6 // extensions_browsertests --gtest_filter=SystemDisplayApiTest.*
8 chrome.test.runTests([
9 function testGet() {
10 for(var i = 0; i < 10; ++i) {
11 chrome.system.display.getInfo(
12 chrome.test.callbackPass(function(result) {
13 chrome.test.assertEq(4, result.length);
14 for (var i = 0; i < result.length; i++) {
15 var info = result[i];
16 chrome.test.assertEq('' + i, info.id);
17 chrome.test.assertEq('DISPLAY NAME FOR ' + i, info.name);
18 chrome.test.assertEq(i == 0 ? true : false, info.isPrimary);
19 chrome.test.assertEq(i == 0 ? true : false, info.isInternal);
20 if (i == 1) {
21 chrome.test.assertEq('0', info.mirroringSourceId);
22 } else {
23 chrome.test.assertEq('', info.mirroringSourceId);
25 chrome.test.assertEq(true, info.isEnabled);
26 chrome.test.assertEq(90 * i, info.rotation);
27 chrome.test.assertEq(96.0, info.dpiX);
28 chrome.test.assertEq(96.0, info.dpiY);
29 chrome.test.assertEq(0, info.bounds.left);
30 chrome.test.assertEq(0, info.bounds.top);
31 chrome.test.assertEq(1280, info.bounds.width);
32 chrome.test.assertEq(720, info.bounds.height);
33 if (i == 0) {
34 chrome.test.assertEq(20, info.overscan.left);
35 chrome.test.assertEq(40, info.overscan.top);
36 chrome.test.assertEq(60, info.overscan.right);
37 chrome.test.assertEq(80, info.overscan.bottom);
38 } else {
39 chrome.test.assertEq(0, info.overscan.left);
40 chrome.test.assertEq(0, info.overscan.top);
41 chrome.test.assertEq(0, info.overscan.right);
42 chrome.test.assertEq(0, info.overscan.bottom);
44 chrome.test.assertEq(0, info.workArea.left);
45 chrome.test.assertEq(0, info.workArea.top);
46 chrome.test.assertEq(960, info.workArea.width);
47 chrome.test.assertEq(720, info.workArea.height);
49 }));
52 ]);