| 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 /** | |
| 90 * Gets a document in the Files.app's window, including iframes. | 75 * Gets a document in the Files.app's window, including iframes. |
| 91 * | 76 * |
| 92 * @param {Window} contentWindow Window to be used. | 77 * @param {Window} contentWindow Window to be used. |
| 93 * @param {string=} opt_iframeQuery Query for the iframe. | 78 * @param {string=} opt_iframeQuery Query for the iframe. |
| 94 * @return {Document=} Returns the found document or undefined if not found. | 79 * @return {Document=} Returns the found document or undefined if not found. |
| 95 * @private | 80 * @private |
| 96 */ | 81 */ |
| 97 test.util.sync.getDocument_ = function(contentWindow, opt_iframeQuery) { | 82 test.util.sync.getDocument_ = function(contentWindow, opt_iframeQuery) { |
| 98 if (opt_iframeQuery) { | 83 if (opt_iframeQuery) { |
| 99 var iframe = contentWindow.document.querySelector(opt_iframeQuery); | 84 var iframe = contentWindow.document.querySelector(opt_iframeQuery); |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 return false; | 647 return false; |
| 663 } else { | 648 } else { |
| 664 console.error('Invalid function name.'); | 649 console.error('Invalid function name.'); |
| 665 return false; | 650 return false; |
| 666 } | 651 } |
| 667 }); | 652 }); |
| 668 }; | 653 }; |
| 669 | 654 |
| 670 // Register the test utils. | 655 // Register the test utils. |
| 671 test.util.registerRemoteTestUtils(); | 656 test.util.registerRemoteTestUtils(); |
| OLD | NEW |