OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 var callbackPass = chrome.test.callbackPass; | 5 var callbackPass = chrome.test.callbackPass; |
6 | 6 |
7 chrome.app.runtime.onLaunched.addListener(function() { | 7 chrome.app.runtime.onLaunched.addListener(function() { |
8 chrome.test.runTests([ | 8 chrome.test.runTests([ |
9 function testCreateWindow() { | 9 function testCreateWindow() { |
10 chrome.app.window.create('test.html', {}, callbackPass(function (win) { | 10 chrome.app.window.create('test.html', {}, callbackPass(function (win) { |
11 chrome.test.assertTrue(typeof win.dom.window === 'object'); | 11 chrome.test.assertTrue(typeof win.dom.window === 'object'); |
12 chrome.test.assertEq('about:blank', win.dom.location.href); | 12 chrome.test.assertEq('about:blank', win.dom.location.href); |
13 chrome.test.assertEq('<html><head></head><body></body></html>', | 13 chrome.test.assertEq('<html><head></head><body></body></html>', |
14 win.dom.document.documentElement.outerHTML); | 14 win.dom.document.documentElement.outerHTML); |
15 })) | 15 })) |
16 }, | 16 }, |
17 | 17 |
18 function testUpdateWindowWidth() { | 18 function testUpdateWindowWidth() { |
19 chrome.app.window.create('test.html', | 19 chrome.app.window.create('test.html', |
20 {width:512, height:384, frame:'custom'}, | 20 {width:512, height:384, frame:'custom'}, |
21 callbackPass(function(win) { | 21 callbackPass(function(win) { |
22 chrome.test.assertEq(512, win.dom.innerWidth); | 22 chrome.test.assertEq(512, win.dom.innerWidth); |
23 chrome.test.assertEq(384, win.dom.innerHeight); | 23 // TODO(jeremya): Window metrics are inconsistent on Mac at the |
| 24 // moment (see http://crbug.com/130184) |
| 25 if (/Mac/.test(navigator.userAgent)) |
| 26 chrome.test.assertEq(406, win.dom.innerHeight); |
| 27 else |
| 28 chrome.test.assertEq(384, win.dom.innerHeight); |
24 var oldWidth = win.dom.outerWidth, oldHeight = win.dom.outerHeight; | 29 var oldWidth = win.dom.outerWidth, oldHeight = win.dom.outerHeight; |
25 win.dom.resizeBy(-256, 0); | 30 win.dom.resizeBy(-256, 0); |
26 chrome.test.assertEq(oldWidth - 256, win.dom.outerWidth); | 31 chrome.test.assertEq(oldWidth - 256, win.dom.outerWidth); |
27 chrome.test.assertEq(oldHeight, win.dom.outerHeight); | 32 chrome.test.assertEq(oldHeight, win.dom.outerHeight); |
28 })); | 33 })); |
29 }, | 34 }, |
30 | 35 |
31 /*function testMaximize() { | 36 /*function testMaximize() { |
32 chrome.app.window.create('test.html', {width: 200, height: 200}, | 37 chrome.app.window.create('test.html', {width: 200, height: 200}, |
33 callbackPass(function(win) { | 38 callbackPass(function(win) { |
(...skipping 26 matching lines...) Expand all Loading... |
60 chrome.test.assertEq(oldHeight, win.innerHeight); | 65 chrome.test.assertEq(oldHeight, win.innerHeight); |
61 }); | 66 }); |
62 }) | 67 }) |
63 win.chrome.app.window.restore(); | 68 win.chrome.app.window.restore(); |
64 }); | 69 }); |
65 win.chrome.app.window.maximize(); | 70 win.chrome.app.window.maximize(); |
66 })); | 71 })); |
67 },*/ | 72 },*/ |
68 ]); | 73 ]); |
69 }); | 74 }); |
OLD | NEW |