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. |
11 * | 11 * |
12 * TODO(olege): Fix style warnings. | 12 * TODO(olege): Fix style warnings. |
13 */ | 13 */ |
14 var pyautoAPI = { | 14 var pyautoAPI = { |
15 /** | 15 /** |
16 * Add the item with given name to the current selection. | 16 * Add the item with given name to the current selection. |
17 * @param {string} name Name of the item to add to selection | 17 * @param {string} name Name of the item to add to selection. |
18 */ | 18 */ |
19 addItemToSelection: function(name) { | 19 addItemToSelection: function(name) { |
20 var entryExists = false; | 20 var entryExists = false; |
21 var dm = fileManager.directoryModel_.getFileList(); | 21 var dm = fileManager.directoryModel_.getFileList(); |
22 for (var i = 0; i < dm.length; i++) { | 22 for (var i = 0; i < dm.length; i++) { |
23 if (dm.item(i).name == name) { | 23 if (dm.item(i).name == name) { |
24 fileManager.currentList_.selectionModel.setIndexSelected(i, true); | 24 fileManager.currentList_.selectionModel.setIndexSelected(i, true); |
25 fileManager.currentList_.scrollIndexIntoView(i); | 25 fileManager.currentList_.scrollIndexIntoView(i); |
26 fileManager.focusCurrentList_(); | 26 fileManager.focusCurrentList_(); |
27 entryExists = true; | 27 entryExists = true; |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 window.domAutomationController.send(JSON.stringify(value)); | 235 window.domAutomationController.send(JSON.stringify(value)); |
236 }, | 236 }, |
237 | 237 |
238 /** | 238 /** |
239 * Callback function signalling completion of operation. | 239 * Callback function signalling completion of operation. |
240 */ | 240 */ |
241 sendDone_: function() { | 241 sendDone_: function() { |
242 window.domAutomationController.send('done'); | 242 window.domAutomationController.send('done'); |
243 } | 243 } |
244 }; | 244 }; |
OLD | NEW |