Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Unified Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/background.js

Issue 177443006: [AudioPlayer] Add test for opening another file from Files.app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adressed the comment Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698