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

Side by Side Diff: ui/file_manager/integration_tests/remote_call.js

Issue 2080613002: Quick View: Add a test that checks Quick View opens with Space key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 4 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
« no previous file with comments | « ui/file_manager/integration_tests/file_manager_test_manifest.json ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 * Class to manipulate the window in the remote extension. 8 * Class to manipulate the window in the remote extension.
9 * 9 *
10 * @param {string} extensionId ID of extension to be manipulated. 10 * @param {string} extensionId ID of extension to be manipulated.
11 * @constructor 11 * @constructor
12 */ 12 */
13 function RemoteCall(extensionId) { 13 function RemoteCall(extensionId) {
14 this.extensionId_ = extensionId; 14 this.extensionId_ = extensionId;
15 } 15 }
16 16
17 /** 17 /**
18 * Checks whether step by step tests are enabled or not. 18 * Checks whether step by step tests are enabled or not.
19 * @return {Promise<bool>} 19 * @return {Promise<bool>}
20 */ 20 */
21 RemoteCall.isStepByStepEnabled = function() { 21 RemoteCall.isStepByStepEnabled = function() {
22 return new Promise(function(fulfill) { 22 return new Promise(function(fulfill) {
23 chrome.commandLinePrivate.hasSwitch( 23 chrome.commandLinePrivate.hasSwitch(
24 'enable-file-manager-step-by-step-tests', fulfill); 24 'enable-file-manager-step-by-step-tests', fulfill);
25 }); 25 });
26 }; 26 };
27 27
28 /** 28 /**
29 * Calls a remote test util in Files.app's extension. See: test_util.js. 29 * Calls a remote test util in Files.app's extension. See:
30 * registerRemoteTestUtils in test_util_base.js.
30 * 31 *
31 * @param {string} func Function name. 32 * @param {string} func Function name.
32 * @param {?string} appId Target window's App ID or null for functions 33 * @param {?string} appId Target window's App ID or null for functions
33 * not requiring a window. 34 * not requiring a window.
34 * @param {Array<*>} args Array of arguments. 35 * @param {Array<*>} args Array of arguments.
35 * @param {function(*)=} opt_callback Callback handling the function's result. 36 * @param {function(*)=} opt_callback Callback handling the function's result.
36 * @return {Promise} Promise to be fulfilled with the result of the remote 37 * @return {Promise} Promise to be fulfilled with the result of the remote
37 * utility. 38 * utility.
38 */ 39 */
39 RemoteCall.prototype.callRemoteTestUtil = 40 RemoteCall.prototype.callRemoteTestUtil =
(...skipping 12 matching lines...) Expand all
52 }); 53 });
53 }).then(function(stepByStep) { 54 }).then(function(stepByStep) {
54 return new Promise(function(onFulfilled) { 55 return new Promise(function(onFulfilled) {
55 chrome.runtime.sendMessage( 56 chrome.runtime.sendMessage(
56 this.extensionId_, 57 this.extensionId_,
57 { 58 {
58 func: func, 59 func: func,
59 appId: appId, 60 appId: appId,
60 args: args 61 args: args
61 }, 62 },
63 {},
62 function(var_args) { 64 function(var_args) {
63 if (stepByStep) { 65 if (stepByStep) {
64 console.info('Returned value:'); 66 console.info('Returned value:');
65 console.info(arguments); 67 console.info(JSON.stringify(arguments));
66 } 68 }
67 if (opt_callback) 69 if (opt_callback)
68 opt_callback.apply(null, arguments); 70 opt_callback.apply(null, arguments);
69 onFulfilled(arguments[0]); 71 onFulfilled(arguments[0]);
70 }); 72 });
71 }.bind(this)); 73 }.bind(this));
72 }.bind(this)); 74 }.bind(this));
73 }; 75 };
74 76
75 /** 77 /**
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 * @param {string} appId App id. 499 * @param {string} appId App id.
498 * @param {string} name File name to be selected. 500 * @param {string} name File name to be selected.
499 * @return {!Promise<boolean>} A promise which will be resolved with true if the 501 * @return {!Promise<boolean>} A promise which will be resolved with true if the
500 * thumbnail has clicked. This method does not guarantee whether the 502 * thumbnail has clicked. This method does not guarantee whether the
501 * thumbnail has actually selected or not. 503 * thumbnail has actually selected or not.
502 */ 504 */
503 RemoteCallGallery.prototype.selectImageInThumbnailMode = function(appId, name) { 505 RemoteCallGallery.prototype.selectImageInThumbnailMode = function(appId, name) {
504 return this.callRemoteTestUtil('fakeMouseClick', appId, 506 return this.callRemoteTestUtil('fakeMouseClick', appId,
505 ['.thumbnail-view > ul > li[title="' + name + '"] > .selection.frame']); 507 ['.thumbnail-view > ul > li[title="' + name + '"] > .selection.frame']);
506 }; 508 };
OLDNEW
« no previous file with comments | « ui/file_manager/integration_tests/file_manager_test_manifest.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698