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

Unified Diff: ui/file_manager/integration_tests/file_manager/background.js

Issue 1092573002: [Files.app] Added a tabindex test for save file dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and fix test failure Created 5 years, 8 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: ui/file_manager/integration_tests/file_manager/background.js
diff --git a/ui/file_manager/integration_tests/file_manager/background.js b/ui/file_manager/integration_tests/file_manager/background.js
index 74a6b8a4fcdbd2785506e8f38ace4e0c288a9ceb..d38a688069bfb336eade3ee5cc142f0b41a2ddd4 100644
--- a/ui/file_manager/integration_tests/file_manager/background.js
+++ b/ui/file_manager/integration_tests/file_manager/background.js
@@ -228,6 +228,58 @@ function openNewWindow(appState, initialRoot, opt_callback) {
}
/**
+ * Opens a file dialog and waits for closing it.
+ *
+ * @param {Object} dialogParams Dialog parameters to be passed to chrome.
+ * fileSystem.chooseEntry() API.
+ * @param {string} volumeName Volume name passed to the selectVolume remote
+ * funciton.
+ * @param {Array.<TestEntryInfo>} expectedSet Expected set of the entries.
+ * @param {function(windowId:string):Promise} closeDialog Function to close the
+ * dialog.
+ * @return {Promise} Promise to be fulfilled with the result entry of the
+ * dialog.
+ */
+function openAndWaitForClosingDialog(
+ dialogParams, volumeName, expectedSet, closeDialog) {
+ var resultPromise = new Promise(function(fulfill) {
+ chrome.fileSystem.chooseEntry(
+ dialogParams,
+ function(entry) { fulfill(entry); });
+ chrome.test.assertTrue(!chrome.runtime.lastError, 'chooseEntry failed.');
+ });
+
+ return remoteCall.waitForWindow('dialog#').then(function(windowId) {
+ return remoteCall.waitForElement(windowId, '#file-list').
+ then(function() {
+ // Wait for initialization of Files.app.
+ return remoteCall.waitForFiles(
+ windowId, TestEntryInfo.getExpectedRows(BASIC_LOCAL_ENTRY_SET));
+ }).
+ then(function() {
+ return remoteCall.callRemoteTestUtil(
+ 'selectVolume', windowId, [volumeName]);
+ }).
+ then(function() {
+ var expectedRows = TestEntryInfo.getExpectedRows(expectedSet);
+ return remoteCall.waitForFiles(windowId, expectedRows);
+ }).
+ then(closeDialog.bind(null, windowId)).
+ then(function() {
+ return repeatUntil(function() {
+ return remoteCall.callRemoteTestUtil('getWindows', null, []).
+ then(function(windows) {
+ if (windows[windowId])
+ return pending('Window %s does not hide.', windowId);
+ else
+ return resultPromise;
+ });
+ });
+ });
+ });
+}
+
+/**
* Opens a Files.app's main window and waits until it is initialized. Fills
* the window with initial files. Should be called for the first window only.
*
« no previous file with comments | « ui/file_manager/file_manager/main.html ('k') | ui/file_manager/integration_tests/file_manager/file_dialog.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698