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

Side by Side Diff: chrome/browser/resources/file_manager/background/js/test_util.js

Issue 230073002: Files.app: Reland r261616: Add a test to rename a file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a test. Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 * Namespace for test related things. 6 * Namespace for test related things.
7 */ 7 */
8 var test = test || {}; 8 var test = test || {};
9 9
10 /** 10 /**
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 }; 222 };
223 223
224 /** 224 /**
225 * Fakes pressing the down arrow until the given |filename| is selected. 225 * Fakes pressing the down arrow until the given |filename| is selected.
226 * 226 *
227 * @param {Window} contentWindow Window to be tested. 227 * @param {Window} contentWindow Window to be tested.
228 * @param {string} filename Name of the file to be selected. 228 * @param {string} filename Name of the file to be selected.
229 * @return {boolean} True if file got selected, false otherwise. 229 * @return {boolean} True if file got selected, false otherwise.
230 */ 230 */
231 test.util.sync.selectFile = function(contentWindow, filename) { 231 test.util.sync.selectFile = function(contentWindow, filename) {
232 var table = contentWindow.document.querySelector('#detail-table'); 232 var rows = contentWindow.document.querySelectorAll('#detail-table li');
233 var rows = table.querySelectorAll('li'); 233 test.util.sync.fakeKeyDown(contentWindow, '#file-list', 'Home', false);
234 for (var index = 0; index < rows.length; ++index) { 234 for (var index = 0; index < rows.length; ++index) {
235 test.util.sync.fakeKeyDown(contentWindow, '#file-list', 'Down', false);
236 var selection = test.util.sync.getSelectedFiles(contentWindow); 235 var selection = test.util.sync.getSelectedFiles(contentWindow);
237 if (selection.length === 1 && selection[0] === filename) 236 if (selection.length === 1 && selection[0] === filename)
238 return true; 237 return true;
238 test.util.sync.fakeKeyDown(contentWindow, '#file-list', 'Down', false);
239 } 239 }
240 console.error('Failed to select file "' + filename + '"'); 240 console.error('Failed to select file "' + filename + '"');
241 return false; 241 return false;
242 }; 242 };
243 243
244 /** 244 /**
245 * Open the file by selectFile and fakeMouseDoubleClick. 245 * Open the file by selectFile and fakeMouseDoubleClick.
246 * 246 *
247 * @param {Window} contentWindow Window to be tested. 247 * @param {Window} contentWindow Window to be tested.
248 * @param {string} filename Name of the file to be opened. 248 * @param {string} filename Name of the file to be opened.
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 return false; 662 return false;
663 } else { 663 } else {
664 console.error('Invalid function name.'); 664 console.error('Invalid function name.');
665 return false; 665 return false;
666 } 666 }
667 }); 667 });
668 }; 668 };
669 669
670 // Register the test utils. 670 // Register the test utils.
671 test.util.registerRemoteTestUtils(); 671 test.util.registerRemoteTestUtils();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698