Chromium Code Reviews| Index: chrome/browser/resources/file_manager/background/js/test_util.js |
| diff --git a/chrome/browser/resources/file_manager/background/js/test_util.js b/chrome/browser/resources/file_manager/background/js/test_util.js |
| index 075bb3fe09641a0df0540e7c4e1c2169196b2e32..ffb1fb8c7a42a21913ee994cc87e965582553a4c 100644 |
| --- a/chrome/browser/resources/file_manager/background/js/test_util.js |
| +++ b/chrome/browser/resources/file_manager/background/js/test_util.js |
| @@ -111,6 +111,31 @@ test.util.async.waitForWindow = function(appIdPrefix, callback) { |
| }; |
| /** |
| + * Close the specified window and wait until it closes. |
|
hirono
2014/03/04 09:14:13
nit: Closes
yoshiki
2014/03/05 02:24:44
Done.
|
| + * |
| + * @param {string} appId AppId of window to be closed. |
| + * @param {function(boolean)} callback Completion callback with the result. True |
| + * if success, false otherwise. |
| + */ |
| +test.util.async.closeWindow = function(appId, callback) { |
| + if (appId in background.appWindows && |
| + background.appWindows[appId].contentWindow) { |
| + background.appWindows[appId].close(); |
| + |
| + test.util.repeatUntilTrue_(function() { |
| + if (appId in background.appWindows) { |
| + return false; |
| + } else { |
| + callback(true); |
| + return true; |
| + } |
| + }); |
| + } else { |
| + callback(false); |
| + } |
| +}; |
| + |
| +/** |
| * Gets a document in the Files.app's window, including iframes. |
| * |
| * @param {Window} contentWindow Window to be used. |