Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 * Extension ID of Files.app. | 8 * Extension ID of Files.app. |
| 9 * @type {string} | 9 * @type {string} |
| 10 * @const | 10 * @const |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 return repeatUntil(function() { | 333 return repeatUntil(function() { |
| 334 return callRemoteTestUtil('getExecutedTasks', windowId, []). | 334 return callRemoteTestUtil('getExecutedTasks', windowId, []). |
| 335 then(function(executedTasks) { | 335 then(function(executedTasks) { |
| 336 if (executedTasks.indexOf(taskId) === -1) | 336 if (executedTasks.indexOf(taskId) === -1) |
| 337 return pending('Executed task is %j', executedTasks); | 337 return pending('Executed task is %j', executedTasks); |
| 338 }); | 338 }); |
| 339 }); | 339 }); |
| 340 } | 340 } |
| 341 | 341 |
| 342 /** | 342 /** |
| 343 * Sends fake key down event. | |
|
mtomasz
2014/04/09 03:38:54
nit: fake -> a fake
hirono
2014/04/09 20:01:13
Done.
| |
| 344 * @param {string} windowId Window ID. | |
| 345 * @param {string} query Query for target element. | |
|
mtomasz
2014/04/09 03:38:54
nit: target -> the target
hirono
2014/04/09 20:01:13
Done.
| |
| 346 * @param {string} keyIdentifer Key identifier. | |
| 347 * @param {boolean} ctrlKey Control key flag. | |
| 348 * @return {Promise} Promise to be fulfilled or rejected depending on the | |
| 349 * result. | |
| 350 */ | |
| 351 function fakeKeyDown(windowId, query, keyIdentifer, ctrlKey) { | |
| 352 return new Promise(function(fulfill, reject) { | |
| 353 callRemoteTestUtil('fakeKeyDown', | |
| 354 windowId, | |
| 355 [query, keyIdentifer, ctrlKey], | |
| 356 function(result) { | |
| 357 if (result) | |
| 358 fulfill(); | |
| 359 else | |
| 360 reject(new Error('Fail to fake key down.')); | |
| 361 }); | |
| 362 }); | |
| 363 } | |
| 364 | |
| 365 /** | |
| 343 * Executes a sequence of test steps. | 366 * Executes a sequence of test steps. |
| 344 * @constructor | 367 * @constructor |
| 345 */ | 368 */ |
| 346 function StepsRunner() { | 369 function StepsRunner() { |
| 347 /** | 370 /** |
| 348 * List of steps. | 371 * List of steps. |
| 349 * @type {Array.<function>} | 372 * @type {Array.<function>} |
| 350 * @private | 373 * @private |
| 351 */ | 374 */ |
| 352 this.steps_ = []; | 375 this.steps_ = []; |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 714 } | 737 } |
| 715 ]); | 738 ]); |
| 716 } | 739 } |
| 717 | 740 |
| 718 /** | 741 /** |
| 719 * Verifies if there are no Javascript errors in any of the app windows. | 742 * Verifies if there are no Javascript errors in any of the app windows. |
| 720 * @param {function()} Completion callback. | 743 * @param {function()} Completion callback. |
| 721 */ | 744 */ |
| 722 function checkIfNoErrorsOccured(callback) { | 745 function checkIfNoErrorsOccured(callback) { |
| 723 callRemoteTestUtil('getErrorCount', null, [], function(count) { | 746 callRemoteTestUtil('getErrorCount', null, [], function(count) { |
| 724 chrome.test.assertEq(0, count); | 747 chrome.test.assertEq(0, count, 'The error count is not 0.'); |
| 725 callback(); | 748 callback(); |
| 726 }); | 749 }); |
| 727 } | 750 } |
| 728 | 751 |
| 729 /** | 752 /** |
| 730 * Returns the name of the given file list entry. | 753 * Returns the name of the given file list entry. |
| 731 * @param {Array.<string>} file An entry in a file list. | 754 * @param {Array.<string>} file An entry in a file list. |
| 732 * @return {string} Name of the file. | 755 * @return {string} Name of the file. |
| 733 */ | 756 */ |
| 734 function getFileName(fileListEntry) { | 757 function getFileName(fileListEntry) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 787 chrome.test.runTests([function() { | 810 chrome.test.runTests([function() { |
| 788 chrome.test.fail(testCaseName + ' is not found.'); | 811 chrome.test.fail(testCaseName + ' is not found.'); |
| 789 }]); | 812 }]); |
| 790 return; | 813 return; |
| 791 } | 814 } |
| 792 chrome.test.runTests([testcase[testCaseName]]); | 815 chrome.test.runTests([testcase[testCaseName]]); |
| 793 } | 816 } |
| 794 ]; | 817 ]; |
| 795 steps.shift()(); | 818 steps.shift()(); |
| 796 }); | 819 }); |
| OLD | NEW |