| Index: chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
|
| diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
|
| index 33fd18e54d66a94b64ff7aa6d40a9eea551d7d18..b07b3f30a2939cf4246e3d49857def85f0b1d733 100644
|
| --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
|
| +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/background.js
|
| @@ -115,8 +115,8 @@ function repeatUntil(checkFunction) {
|
|
|
| /**
|
| * Waits until a window having the given ID prefix appears.
|
| - * @param {string} appIdPrefix ID prefix of the requested window.
|
| - * @param {Promise} promise Promise to be fulfilled with a found window's ID.
|
| + * @param {string} windowIdPrefix ID prefix of the requested window.
|
| + * @return {Promise} promise Promise to be fulfilled with a found window's ID.
|
| */
|
| function waitForWindow(windowIdPrefix) {
|
| return repeatUntil(function() {
|
| @@ -131,6 +131,40 @@ function waitForWindow(windowIdPrefix) {
|
| }
|
|
|
| /**
|
| + * Closes a window and waits until the window is closed.
|
| + *
|
| + * @param {string} windowId ID of the window to close.
|
| + * @return {Promise} promise Promise to be fulfilled with the result (true:
|
| + * success, false: failed).
|
| + */
|
| +function closeWindowAndWait(windowId) {
|
| + // Closes the window.
|
| + return callRemoteTestUtil('closeWindow', null, [windowId]).then(
|
| + function(result) {
|
| + // Returns false when the closing is failed.
|
| + if (!result)
|
| + return false;
|
| +
|
| + return repeatUntil(function() {
|
| + return callRemoteTestUtil('getWindows', null, []).then(
|
| + function(windows) {
|
| + for (var id in windows) {
|
| + if (id === windowId) {
|
| + // Window is still available. Continues waiting.
|
| + return pending('Window with the prefix %s is not found.',
|
| + windowId);
|
| + }
|
| + }
|
| + // Window is not available. Closing is done successfully.
|
| + return true;
|
| + }
|
| + );
|
| + });
|
| + }
|
| + );
|
| +}
|
| +
|
| +/**
|
| * Waits until the window turns to the given size.
|
| * @param {string} windowId Target window ID.
|
| * @param {number} width Requested width in pixels.
|
|
|