| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 /** | 5 /** |
| 6 * Namespace for test related things. | 6 * Namespace for test related things. |
| 7 */ | 7 */ |
| 8 var test = test || {}; | 8 var test = test || {}; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 var windowWrapper = background.appWindows[id]; | 65 var windowWrapper = background.appWindows[id]; |
| 66 windows[id] = { | 66 windows[id] = { |
| 67 innerWidth: windowWrapper.contentWindow.innerWidth, | 67 innerWidth: windowWrapper.contentWindow.innerWidth, |
| 68 innerHeight: windowWrapper.contentWindow.innerHeight | 68 innerHeight: windowWrapper.contentWindow.innerHeight |
| 69 }; | 69 }; |
| 70 } | 70 } |
| 71 return windows; | 71 return windows; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * Closes the specified window. |
| 76 * |
| 77 * @param {string} appId AppId of window to be closed. |
| 78 * @return {boolean} Result: True if success, false otherwise. |
| 79 */ |
| 80 test.util.sync.closeWindow = function(appId) { |
| 81 if (appId in background.appWindows && |
| 82 background.appWindows[appId].contentWindow) { |
| 83 background.appWindows[appId].close(); |
| 84 return true; |
| 85 } |
| 86 return false; |
| 87 }; |
| 88 |
| 89 /** |
| 75 * Gets a document in the Files.app's window, including iframes. | 90 * Gets a document in the Files.app's window, including iframes. |
| 76 * | 91 * |
| 77 * @param {Window} contentWindow Window to be used. | 92 * @param {Window} contentWindow Window to be used. |
| 78 * @param {string=} opt_iframeQuery Query for the iframe. | 93 * @param {string=} opt_iframeQuery Query for the iframe. |
| 79 * @return {Document=} Returns the found document or undefined if not found. | 94 * @return {Document=} Returns the found document or undefined if not found. |
| 80 * @private | 95 * @private |
| 81 */ | 96 */ |
| 82 test.util.sync.getDocument_ = function(contentWindow, opt_iframeQuery) { | 97 test.util.sync.getDocument_ = function(contentWindow, opt_iframeQuery) { |
| 83 if (opt_iframeQuery) { | 98 if (opt_iframeQuery) { |
| 84 var iframe = contentWindow.document.querySelector(opt_iframeQuery); | 99 var iframe = contentWindow.document.querySelector(opt_iframeQuery); |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 return false; | 662 return false; |
| 648 } else { | 663 } else { |
| 649 console.error('Invalid function name.'); | 664 console.error('Invalid function name.'); |
| 650 return false; | 665 return false; |
| 651 } | 666 } |
| 652 }); | 667 }); |
| 653 }; | 668 }; |
| 654 | 669 |
| 655 // Register the test utils. | 670 // Register the test utils. |
| 656 test.util.registerRemoteTestUtils(); | 671 test.util.registerRemoteTestUtils(); |
| OLD | NEW |