Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 var callbackPass = chrome.test.callbackPass; | |
| 6 | |
| 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([ | |
| 11 function testCreateWindow() { | |
| 12 var getShellWindowCount = function(callback) { | |
| 13 chrome.windows.getAll(function(windows) { | |
| 14 callback(windows.filter( | |
| 15 function(window) { return window.type == 'shell'}).length); | |
|
miket_OOO
2012/04/06 18:05:01
Not a biggie, but whitespace inside { } isn't bala
Mihai Parparita -not on Chrome
2012/04/06 22:02:59
Fixed.
| |
| 16 }); | |
| 17 }; | |
| 18 | |
| 19 getShellWindowCount(callbackPass(function(shellWindowCount) { | |
| 20 chrome.test.assertEq(0, shellWindowCount); | |
| 21 chrome.windows.create( | |
| 22 {type: 'shell', width: 128, height: 128}, | |
| 23 callbackPass(function() { | |
| 24 getShellWindowCount(callbackPass(function(shellWindowCount) { | |
| 25 chrome.test.assertEq(1, shellWindowCount); | |
| 26 })); | |
| 27 })); | |
| 28 })); | |
| 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 ]); | |
| 55 }); | |
| OLD | NEW |