OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 pass = chrome.test.callbackPass; |
| 6 |
| 7 var previousTop = 0; |
| 8 var left = 0; |
| 9 var width = 0; |
| 10 var height = 0; |
| 11 |
| 12 var chromeWindow = null; |
| 13 |
| 14 function checkDimensions(currentWindow) { |
| 15 chrome.test.assertEq(previousTop, currentWindow.top); |
| 16 chrome.test.assertEq(left, currentWindow.left); |
| 17 chrome.test.assertEq(width, currentWindow.width); |
| 18 chrome.test.assertEq(height, currentWindow.height); |
| 19 } |
| 20 |
| 21 function setFocus(tab) { |
| 22 previousTop = chromeWindow.top; |
| 23 left = chromeWindow.left; |
| 24 width = chromeWindow.width; |
| 25 height = chromeWindow.height; |
| 26 |
| 27 chrome.windows.update( |
| 28 chromeWindow.id, { 'focused': true }, |
| 29 pass(checkDimensions) |
| 30 ); |
| 31 } |
| 32 |
| 33 chrome.test.runTests([ |
| 34 function setFocusWithNoResize() { |
| 35 chrome.windows.getCurrent( |
| 36 pass(function(currentWindow) { |
| 37 chromeWindow = currentWindow; |
| 38 chrome.tabs.create( |
| 39 { 'windowId': currentWindow.id, 'url': 'blank.html' }, |
| 40 pass(setFocus) |
| 41 ); |
| 42 })); |
| 43 } |
| 44 ]); |
OLD | NEW |