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

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

Issue 216513004: Files.app: Add a test to create new folder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. Created 6 years, 9 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
« no previous file with comments | « chrome/browser/resources/file_manager/foreground/js/file_manager.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/extensions/api_test/file_manager_browsertest/keyboard_operations.js
diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/keyboard_operations.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/keyboard_operations.js
index 31adbf83da0067ca1ab8b08ceb1cb59310d8ffb9..8709bec3bdfd3ea46442db673fa89ecbb2ff0de6 100644
--- a/chrome/test/data/extensions/api_test/file_manager_browsertest/keyboard_operations.js
+++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/keyboard_operations.js
@@ -127,6 +127,62 @@ function keyboardDelete(path) {
]);
}
+/**
+ * Adds check of chrome.test to the end of the given promise.
+ * @param {Promise} promise Promise.
+ */
+function testPromise(promise) {
+ promise.then(function() {
+ return new Promise(checkIfNoErrorsOccured);
+ }).then(chrome.test.callbackPass(function() {
+ chrome.test.succeed();
+ }), function(error) {
+ chrome.test.fail(error.stack || error);
+ });
+};
+
+/**
+ * Test for creating new folder.
+ * @param {string} path Initial path.
+ * @param {Array.<TestEntryInfo>} initialEntrySet Initial set of entries.
+ * @return {Promise} Promise to be fulfilled on success.
+ */
+function createNewFolder(path, initialEntrySet) {
+ var windowId;
+ // Open window.
+ return new Promise(function(callback) {
+ setupAndWaitUntilReady(null, path, callback);
+ }).then(function(inWindowId) {
+ windowId = inWindowId;
+ // Push Ctrl + E.
+ return callRemoteTestUtil('fakeKeyDown',
+ windowId,
+ // Ctrl + E
+ ['#file-list', 'U+0045', true]);
+ }).then(function() {
+ // Wait for rename text field.
+ return waitForElement(windowId, 'input.rename');
+ }).then(function() {
+ // Type new folder name.
+ return callRemoteTestUtil(
+ 'inputText', windowId, ['input.rename', 'Test Folder Name']);
+ }).then(function() {
+ // Push Enter.
+ return callRemoteTestUtil('fakeKeyDown',
+ windowId,
+ ['input.rename', 'Enter', false]);
+ }).then(function() {
+ return waitForElementLost(windowId, 'input.rename');
+ }).then(function() {
+ var expectedEntryRows = TestEntryInfo.getExpectedRows(initialEntrySet);
+ expectedEntryRows.push(['Test Folder Name', '--', 'Folder', '']);
+ // Wait for the new folder.
+ return waitForFiles(windowId,
+ expectedEntryRows,
+ {ignoreLastModifiedTime: true});
+ });
+};
+
testcase.keyboardCopyDownloads = function() {
keyboardCopy(RootPath.DOWNLOADS);
};
@@ -142,3 +198,11 @@ testcase.keyboardCopyDrive = function() {
testcase.keyboardDeleteDrive = function() {
keyboardDelete(RootPath.DRIVE);
};
+
+testcase.createNewFolderDownloads = function() {
+ testPromise(createNewFolder(RootPath.DOWNLOADS, BASIC_LOCAL_ENTRY_SET));
+};
+
+testcase.createNewFolderDrive = function() {
+ testPromise(createNewFolder(RootPath.DRIVE, BASIC_DRIVE_ENTRY_SET));
+};
« no previous file with comments | « chrome/browser/resources/file_manager/foreground/js/file_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698