OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 /** | 5 /** |
6 * pyautoAPI object provides a set of functions used by PyAuto tests | 6 * pyautoAPI object provides a set of functions used by PyAuto tests |
7 * to drive the file manager. | 7 * to drive the file manager. |
8 * | 8 * |
9 * Refer to chrome/test/functional/chromeos_file_browser.py for examples | 9 * Refer to chrome/test/functional/chromeos_file_browser.py for examples |
10 * of how this API is used. | 10 * of how this API is used. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 renameItem: function(name) { | 141 renameItem: function(name) { |
142 var entry = fileManager.selection.entries[0]; | 142 var entry = fileManager.selection.entries[0]; |
143 fileManager.directoryModel_.renameEntry(entry, name, this.sendDone_, | 143 fileManager.directoryModel_.renameEntry(entry, name, this.sendDone_, |
144 this.sendDone_); | 144 this.sendDone_); |
145 }, | 145 }, |
146 | 146 |
147 /** | 147 /** |
148 * Delete selected entries. | 148 * Delete selected entries. |
149 */ | 149 */ |
150 deleteItems: function() { | 150 deleteItems: function() { |
151 var entries = fileManager.selection.entries; | 151 var dm = fileManager.directoryModel_; |
152 fileManager.deleteEntries(entries, true, this.sendDone_); | 152 var onRescan = function() { |
| 153 dm.removeEventListener('rescan-completed', onRescan); |
| 154 this.sendDone_(); |
| 155 }.bind(this); |
| 156 |
| 157 dm.addEventListener('rescan-completed', onRescan); |
| 158 fileManager.deleteSelection(); |
153 }, | 159 }, |
154 | 160 |
155 /** | 161 /** |
156 * Create directory. | 162 * Create directory. |
157 * | 163 * |
158 * @param {string} name Name of the directory. | 164 * @param {string} name Name of the directory. |
159 */ | 165 */ |
160 createDirectory: function(name) { | 166 createDirectory: function(name) { |
161 var dm = fileManager.directoryModel_; | 167 var dm = fileManager.directoryModel_; |
162 var onRescan = function() { | 168 var onRescan = function() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 window.domAutomationController.send(JSON.stringify(value)); | 246 window.domAutomationController.send(JSON.stringify(value)); |
241 }, | 247 }, |
242 | 248 |
243 /** | 249 /** |
244 * Callback function signalling completion of operation. | 250 * Callback function signalling completion of operation. |
245 */ | 251 */ |
246 sendDone_: function() { | 252 sendDone_: function() { |
247 window.domAutomationController.send('done'); | 253 window.domAutomationController.send('done'); |
248 } | 254 } |
249 }; | 255 }; |
OLD | NEW |