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

Unified Diff: ui/file_manager/integration_tests/file_manager/tab_index.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/tab_index.js
diff --git a/ui/file_manager/integration_tests/file_manager/tab_index.js b/ui/file_manager/integration_tests/file_manager/tab_index.js
index 57b9c531bbddc27c3c158d824bc0f305179c8714..fd7ae6e0ddbe1a77c233d7bbfabb413ba168f73b 100644
--- a/ui/file_manager/integration_tests/file_manager/tab_index.js
+++ b/ui/file_manager/integration_tests/file_manager/tab_index.js
@@ -191,21 +191,41 @@ testcase.tabindexFocusDirectorySelected = function() {
/**
* Tests the tab focus in the dialog and closes the dialog.
+ *
+ * @param {Object} dialogParams Dialog parameters to be passed to
+ * chrome.fileSystem.chooseEntry.
+ * @param {string} volumeName Volume name passed to the selectVolume remote
+ * function.
+ * @param {Array.<TestEntryInfo>} expectedSet Expected set of the entries.
+ * @param {boolean} selectFile True to select 'hello.txt' before the tab order
+ * check, false do not select any file before the check.
+ * @param {string} initialElement Selector of the element which shows ready.
+ * @param {Array.<string>} expectedTabOrder Array with the IDs of the element
+ * with the corresponding order of expected tab-indexes.
*/
-function tabindexFocus(volumeName, expectedSet, expectedTabOrder) {
+function tabindexFocus(dialogParams, volumeName, expectedSet, selectFile,
+ initialElement, expectedTabOrder) {
var localEntriesPromise = addEntries(['local'], BASIC_LOCAL_ENTRY_SET);
var driveEntriesPromise = addEntries(['drive'], BASIC_DRIVE_ENTRY_SET);
var setupPromise = Promise.all([localEntriesPromise, driveEntriesPromise]);
- var checkAndClose = function(appId) {
- var promise = remoteCall.callRemoteTestUtil('getActiveElement', appId, []);
+ var selectAndCheckAndClose = function(appId) {
+ var promise = Promise.resolve();
+
+ if (selectFile) {
+ promise = promise.then(function() {
+ return remoteCall.callRemoteTestUtil(
+ 'selectFile', appId, ['hello.txt']);
+ });
+ }
+
promise = promise.then(function() {
- return remoteCall.waitForElement(appId, ['#ok-button:not([disabled])']);
+ return remoteCall.callRemoteTestUtil('getActiveElement', appId, []);
});
- // Checks initial focus.
+ // Waits for the initial element.
promise = promise.then(function() {
- return remoteCall.waitForElement(appId, ['#file-list:focus']);
+ return remoteCall.waitForElement(appId, [initialElement]);
});
// Checks tabfocus.
@@ -220,16 +240,15 @@ function tabindexFocus(volumeName, expectedSet, expectedTabOrder) {
promise = promise.then(function() {
// Closes the window by pressing Enter.
return remoteCall.callRemoteTestUtil(
- 'fakeKeyDown',
- appId,
- ['#file-list', 'Enter', false]);
+ 'fakeKeyDown', appId, ['#file-list', 'Enter', false]);
});
return promise;
};
return setupPromise.then(function() {
- return openAndWaitForClosingDialog(volumeName, expectedSet, checkAndClose);
+ return openAndWaitForClosingDialog(
+ dialogParams, volumeName, expectedSet, selectAndCheckAndClose);
});
}
@@ -238,9 +257,10 @@ function tabindexFocus(volumeName, expectedSet, expectedTabOrder) {
*/
testcase.tabindexOpenDialogDownloads = function() {
testPromise(tabindexFocus(
- 'downloads', BASIC_LOCAL_ENTRY_SET,
- ['ok-button', 'cancel-button', 'search-button', 'view-button',
- 'gear-button', 'directory-tree', 'file-list']));
+ {type: 'openFile'}, 'downloads', BASIC_LOCAL_ENTRY_SET, true,
+ '#ok-button:not([disabled])',
+ ['ok-button', 'cancel-button', 'search-button', 'view-button',
+ 'gear-button', 'directory-tree', 'file-list']));
};
/**
@@ -248,7 +268,40 @@ testcase.tabindexOpenDialogDownloads = function() {
*/
testcase.tabindexOpenDialogDrive = function() {
testPromise(tabindexFocus(
- 'drive', BASIC_DRIVE_ENTRY_SET,
- ['ok-button', 'cancel-button', 'search-button', 'view-button',
- 'gear-button', 'directory-tree', 'file-list']));
+ {type: 'openFile'}, 'drive', BASIC_DRIVE_ENTRY_SET, true,
+ '#ok-button:not([disabled])',
+ ['ok-button', 'cancel-button', 'search-button', 'view-button',
+ 'gear-button', 'directory-tree', 'file-list']));
+};
+
+/**
+ * Tests the tab focus behavior of Save File Dialog (Downloads).
+ */
+testcase.tabindexSaveFileDialogDownloads = function() {
+ testPromise(tabindexFocus(
+ {
+ type: 'saveFile',
+ suggestedName: 'hoge.txt' // Prevent showing a override prompt
+ },
+ 'downloads', BASIC_LOCAL_ENTRY_SET, false,
+ '#ok-button:not([disabled])',
+ ['ok-button', 'cancel-button', 'search-button', 'view-button',
+ 'gear-button', 'directory-tree', 'file-list', 'new-folder-button',
+ 'filename-input-textbox']));
+};
+
+/**
+ * Tests the tab focus behavior of Save File Dialog (Drive).
+ */
+testcase.tabindexSaveFileDialogDrive = function() {
+ testPromise(tabindexFocus(
+ {
+ type: 'saveFile',
+ suggestedName: 'hoge.txt' // Prevent showing a override prompt
+ },
+ 'drive', BASIC_DRIVE_ENTRY_SET, false,
+ '#ok-button:not([disabled])',
+ ['ok-button', 'cancel-button', 'search-button', 'view-button',
+ 'gear-button', 'directory-tree', 'file-list', 'new-folder-button',
+ 'filename-input-textbox']));
};

Powered by Google App Engine
This is Rietveld 408576698