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.experimental.app.onLaunched.addListener(function() { | 7 chrome.experimental.app.onLaunched.addListener(function() { |
8 // Only a few chrome.windows.* API methods are tested, it is assumed that the | |
9 // full API is tested elsewhere. | |
10 chrome.test.runTests([ | 8 chrome.test.runTests([ |
11 function testCreateWindow() { | 9 function testCreateWindow() { |
12 var getShellWindowCount = function(callback) { | 10 chrome.appWindow.create('test.html', {}, callbackPass(function (win) { |
13 chrome.windows.getAll(function(windows) { | 11 chrome.test.assertTrue(win.true); |
Mihai Parparita -not on Chrome
2012/05/24 21:16:04
Does this actually work? "true" is not a property
jeremya
2012/05/28 04:30:03
Oops, right you are.
| |
14 callback(windows.filter( | 12 })) |
15 function(window) { return window.type == 'shell' }).length); | 13 }, |
16 }); | |
17 }; | |
18 | 14 |
19 getShellWindowCount(callbackPass(function(shellWindowCount) { | 15 function testUpdateWindowWidth() { |
20 chrome.test.assertEq(0, shellWindowCount); | 16 chrome.windows.create('test.html', {width: 128, height: 128}, |
Mihai Parparita -not on Chrome
2012/05/24 21:16:04
This needs to be updated to chrome.appWindow.creat
jeremya
2012/05/28 04:30:03
Can you tell I didn't run the tests? >_>
| |
21 chrome.windows.create( | 17 callbackPass(function(win) { |
22 {type: 'shell', width: 128, height: 128}, | 18 chrome.test.assertEq(win.outerWidth, 128) |
23 callbackPass(function() { | 19 chrome.test.assertEq(win.outerHeight, 128) |
24 getShellWindowCount(callbackPass(function(shellWindowCount) { | 20 win.resizeTo(256, 128) |
25 chrome.test.assertEq(1, shellWindowCount); | 21 chrome.test.assertEq(win.outerWidth, 256) |
26 })); | 22 chrome.test.assertEq(win.outerHeight, 128) |
27 })); | 23 })); |
28 })); | 24 }, |
29 }, | |
30 | |
31 function testUpdateWindowWidth() { | |
32 chrome.windows.create( | |
33 {type: 'shell', width: 128, height: 128}, | |
34 callbackPass(function(window) { | |
35 chrome.windows.update( | |
36 window.id, | |
37 // 256 is a width that will snap to the Aura grid, thus this | |
38 // should be the actual width on Aura (when read back). | |
39 {width: 256, height: 128}, | |
40 callbackPass(function() { | |
41 // The timeout is rather lame, but reading back the width from | |
42 // the window manager (on Linux) immediately still reports the | |
43 // old value. | |
44 setTimeout(callbackPass(function() { | |
45 chrome.windows.getCurrent(callbackPass(function(window) { | |
46 chrome.test.assertEq(256, window.width); | |
47 })); | |
48 }), 1000); | |
49 })); | |
50 })); | |
51 }, | |
52 | |
53 | |
54 ]); | 25 ]); |
55 }); | 26 }); |
OLD | NEW |