| 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.runtime.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); |
| 16 }); |
| 17 }; |
| 18 |
| 19 getShellWindowCount(callbackPass(function(shellWindowCount) { |
| 20 chrome.test.assertEq(0, shellWindowCount); |
| 21 chrome.windows.create({type: 'shell'}, callbackPass(function() { |
| 22 getShellWindowCount(callbackPass(function(shellWindowCount) { |
| 23 chrome.test.assertEq(1, shellWindowCount); |
| 24 })); |
| 25 })); |
| 26 })); |
| 27 }, |
| 28 |
| 29 function testUpdateWindowWidth() { |
| 30 chrome.windows.create({type: 'shell'}, callbackPass(function(window) { |
| 31 chrome.windows.update( |
| 32 window.id, |
| 33 // 256 is a width that will snap to the Aura grid, thus this should |
| 34 // be the actual width on Aura (when read back). |
| 35 {width: 256}, |
| 36 callbackPass(function() { |
| 37 // The timeout is rather lame, but reading back the width from the |
| 38 // window manager (on Linux) immediately still reports the old |
| 39 // value. |
| 40 setTimeout(callbackPass(function() { |
| 41 chrome.windows.getCurrent(callbackPass(function(window) { |
| 42 chrome.test.assertEq(256, window.width); |
| 43 })); |
| 44 }), 200); |
| 45 })); |
| 46 })); |
| 47 }, |
| 48 |
| 49 |
| 50 ]); |
| 51 }); |
| OLD | NEW |