| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Constants for interacting with the directory tree on the LHS of Files. | 8 * Constants for interacting with the directory tree on the LHS of Files. |
| 9 * When we are not in guest mode, we fill Google Drive with the basic entry set | 9 * When we are not in guest mode, we fill Google Drive with the basic entry set |
| 10 * which causes an extra tree-item to be added. | 10 * which causes an extra tree-item to be added. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 return Promise.resolve().then(function() { | 27 return Promise.resolve().then(function() { |
| 28 // Ensure no selected item. | 28 // Ensure no selected item. |
| 29 return remoteCall.waitForElementLost( | 29 return remoteCall.waitForElementLost( |
| 30 windowId, | 30 windowId, |
| 31 'div.detail-table > list > li[selected]'); | 31 'div.detail-table > list > li[selected]'); |
| 32 }).then(function() { | 32 }).then(function() { |
| 33 // Push Down. | 33 // Push Down. |
| 34 return remoteCall.callRemoteTestUtil( | 34 return remoteCall.callRemoteTestUtil( |
| 35 'fakeKeyDown', windowId, | 35 'fakeKeyDown', windowId, |
| 36 // Down | 36 // Down |
| 37 ['#file-list', 'Down', true, false, false]); | 37 ['#file-list', 'ArrowDown', 'Down', true, false, false]); |
| 38 }).then(function() { | 38 }).then(function() { |
| 39 // Wait for selection. | 39 // Wait for selection. |
| 40 return remoteCall.waitForElement(windowId, | 40 return remoteCall.waitForElement(windowId, |
| 41 'div.detail-table > list > li[selected]'); | 41 'div.detail-table > list > li[selected]'); |
| 42 }).then(function() { | 42 }).then(function() { |
| 43 // Ensure that only the first item is selected. | 43 // Ensure that only the first item is selected. |
| 44 return remoteCall.callRemoteTestUtil( | 44 return remoteCall.callRemoteTestUtil( |
| 45 'queryAllElements', | 45 'queryAllElements', |
| 46 windowId, | 46 windowId, |
| 47 ['div.detail-table > list > li[selected]']); | 47 ['div.detail-table > list > li[selected]']); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 58 * @param {Array<TestEntryInfo>} initialEntrySet Initial set of entries. | 58 * @param {Array<TestEntryInfo>} initialEntrySet Initial set of entries. |
| 59 * @return {Promise} Promise to be fulfilled on success. | 59 * @return {Promise} Promise to be fulfilled on success. |
| 60 */ | 60 */ |
| 61 function createNewFolder(windowId, path, initialEntrySet) { | 61 function createNewFolder(windowId, path, initialEntrySet) { |
| 62 return Promise.resolve( | 62 return Promise.resolve( |
| 63 ).then(function() { | 63 ).then(function() { |
| 64 // Push Ctrl + E. | 64 // Push Ctrl + E. |
| 65 return remoteCall.callRemoteTestUtil( | 65 return remoteCall.callRemoteTestUtil( |
| 66 'fakeKeyDown', windowId, | 66 'fakeKeyDown', windowId, |
| 67 // Ctrl + E | 67 // Ctrl + E |
| 68 ['#file-list', 'U+0045', true, false, false]); | 68 ['#file-list', 'e', 'U+0045', true, false, false]); |
| 69 }).then(function() { | 69 }).then(function() { |
| 70 // Wait for rename text field. | 70 // Wait for rename text field. |
| 71 return remoteCall.waitForElement(windowId, 'li[renaming] input.rename'); | 71 return remoteCall.waitForElement(windowId, 'li[renaming] input.rename'); |
| 72 }).then(function() { | 72 }).then(function() { |
| 73 return remoteCall.callRemoteTestUtil( | 73 return remoteCall.callRemoteTestUtil( |
| 74 'queryAllElements', | 74 'queryAllElements', |
| 75 windowId, | 75 windowId, |
| 76 ['div.detail-table > list > li[selected]']); | 76 ['div.detail-table > list > li[selected]']); |
| 77 }).then(function(elements) { | 77 }).then(function(elements) { |
| 78 // Ensure that only the new directory is selected and being renamed. | 78 // Ensure that only the new directory is selected and being renamed. |
| 79 chrome.test.assertEq(1, elements.length); | 79 chrome.test.assertEq(1, elements.length); |
| 80 chrome.test.assertTrue('renaming' in elements[0].attributes); | 80 chrome.test.assertTrue('renaming' in elements[0].attributes); |
| 81 }).then(function() { | 81 }).then(function() { |
| 82 // Check directory tree for new folder. | 82 // Check directory tree for new folder. |
| 83 if (chrome.extension.inIncognitoContext) | 83 if (chrome.extension.inIncognitoContext) |
| 84 return remoteCall.waitForElement(windowId, NEWFOLDER_GUEST); | 84 return remoteCall.waitForElement(windowId, NEWFOLDER_GUEST); |
| 85 else | 85 else |
| 86 return remoteCall.waitForElement(windowId, NEWFOLDER); | 86 return remoteCall.waitForElement(windowId, NEWFOLDER); |
| 87 }).then(function() { | 87 }).then(function() { |
| 88 // Type new folder name. | 88 // Type new folder name. |
| 89 return remoteCall.callRemoteTestUtil( | 89 return remoteCall.callRemoteTestUtil( |
| 90 'inputText', windowId, ['input.rename', 'Test Folder Name']); | 90 'inputText', windowId, ['input.rename', 'Test Folder Name']); |
| 91 }).then(function() { | 91 }).then(function() { |
| 92 // Push Enter. | 92 // Push Enter. |
| 93 return remoteCall.callRemoteTestUtil( | 93 return remoteCall.callRemoteTestUtil( |
| 94 'fakeKeyDown', | 94 'fakeKeyDown', |
| 95 windowId, | 95 windowId, |
| 96 ['input.rename', 'Enter', false, false, false]); | 96 ['input.rename', 'Enter', 'Enter', false, false, false]); |
| 97 }).then(function() { | 97 }).then(function() { |
| 98 // Wait until rename completes. | 98 // Wait until rename completes. |
| 99 return remoteCall.waitForElementLost(windowId, 'input.rename'); | 99 return remoteCall.waitForElementLost(windowId, 'input.rename'); |
| 100 }).then(function() { | 100 }).then(function() { |
| 101 // Once it is renamed, the original 'New Folder' item is removed. | 101 // Once it is renamed, the original 'New Folder' item is removed. |
| 102 if (chrome.extension.inIncognitoContext) | 102 if (chrome.extension.inIncognitoContext) |
| 103 return remoteCall.waitForElementLost(windowId, NEWFOLDER_GUEST); | 103 return remoteCall.waitForElementLost(windowId, NEWFOLDER_GUEST); |
| 104 else | 104 else |
| 105 return remoteCall.waitForElementLost(windowId, NEWFOLDER); | 105 return remoteCall.waitForElementLost(windowId, NEWFOLDER); |
| 106 }).then(function() { | 106 }).then(function() { |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 windowId = results.windowId | 204 windowId = results.windowId |
| 205 return expandRoot(windowId, TREEITEM_DRIVE); | 205 return expandRoot(windowId, TREEITEM_DRIVE); |
| 206 }).then(function() { | 206 }).then(function() { |
| 207 return remoteCall.waitForElement(windowId, '#detail-table') | 207 return remoteCall.waitForElement(windowId, '#detail-table') |
| 208 }).then(function() { | 208 }).then(function() { |
| 209 return createNewFolder(windowId, PATH, BASIC_DRIVE_ENTRY_SET); | 209 return createNewFolder(windowId, PATH, BASIC_DRIVE_ENTRY_SET); |
| 210 }); | 210 }); |
| 211 | 211 |
| 212 testPromise(promise); | 212 testPromise(promise); |
| 213 }; | 213 }; |
| OLD | NEW |