| OLD | NEW |
| 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. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 return pending('Elements %j is still exists.', elements); | 194 return pending('Elements %j is still exists.', elements); |
| 195 return true; | 195 return true; |
| 196 }); | 196 }); |
| 197 }.bind(this)); | 197 }.bind(this)); |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 /** | 200 /** |
| 201 * Sends a fake key down event. | 201 * Sends a fake key down event. |
| 202 * @param {string} windowId Window ID. | 202 * @param {string} windowId Window ID. |
| 203 * @param {string} query Query for the target element. | 203 * @param {string} query Query for the target element. |
| 204 * @param {string} key DOM UI Events Key value. |
| 204 * @param {string} keyIdentifer Key identifier. | 205 * @param {string} keyIdentifer Key identifier. |
| 205 * @param {boolean} ctrlKey Control key flag. | 206 * @param {boolean} ctrlKey Control key flag. |
| 206 * @param {boolean} shiftKey Shift key flag. | 207 * @param {boolean} shiftKey Shift key flag. |
| 207 * @param {boolean} altKey Alt key flag. | 208 * @param {boolean} altKey Alt key flag. |
| 208 * @return {Promise} Promise to be fulfilled or rejected depending on the | 209 * @return {Promise} Promise to be fulfilled or rejected depending on the |
| 209 * result. | 210 * result. |
| 210 */ | 211 */ |
| 211 RemoteCall.prototype.fakeKeyDown = | 212 RemoteCall.prototype.fakeKeyDown = |
| 212 function(windowId, query, keyIdentifer, ctrlKey, shiftKey, altKey) { | 213 function(windowId, query, key, keyIdentifer, ctrlKey, shiftKey, altKey) { |
| 213 var resultPromise = this.callRemoteTestUtil( | 214 var resultPromise = this.callRemoteTestUtil( |
| 214 'fakeKeyDown', windowId, | 215 'fakeKeyDown', windowId, |
| 215 [query, keyIdentifer, ctrlKey, shiftKey, altKey]); | 216 [query, key, keyIdentifer, ctrlKey, shiftKey, altKey]); |
| 216 return resultPromise.then(function(result) { | 217 return resultPromise.then(function(result) { |
| 217 if (result) | 218 if (result) |
| 218 return true; | 219 return true; |
| 219 else | 220 else |
| 220 return Promise.reject('Fail to fake key down.'); | 221 return Promise.reject('Fail to fake key down.'); |
| 221 }); | 222 }); |
| 222 }; | 223 }; |
| 223 | 224 |
| 224 /** | 225 /** |
| 225 * Gets file entries just under the volume. | 226 * Gets file entries just under the volume. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 * Check if the next tabforcus'd element has the given ID or not. | 356 * Check if the next tabforcus'd element has the given ID or not. |
| 356 * @param {string} windowId Target window ID. | 357 * @param {string} windowId Target window ID. |
| 357 * @param {string} elementId String of 'id' attribute which the next tabfocus'd | 358 * @param {string} elementId String of 'id' attribute which the next tabfocus'd |
| 358 * element should have. | 359 * element should have. |
| 359 * @return {Promise} Promise to be fulfilled with the result. | 360 * @return {Promise} Promise to be fulfilled with the result. |
| 360 */ | 361 */ |
| 361 RemoteCallFilesApp.prototype.checkNextTabFocus = | 362 RemoteCallFilesApp.prototype.checkNextTabFocus = |
| 362 function(windowId, elementId) { | 363 function(windowId, elementId) { |
| 363 return remoteCall.callRemoteTestUtil('fakeKeyDown', | 364 return remoteCall.callRemoteTestUtil('fakeKeyDown', |
| 364 windowId, | 365 windowId, |
| 365 ['body', 'U+0009', false]).then( | 366 ['body', 'Tab', 'U+0009', false]).then( |
| 366 function(result) { | 367 function(result) { |
| 367 chrome.test.assertTrue(result); | 368 chrome.test.assertTrue(result); |
| 368 return remoteCall.callRemoteTestUtil('getActiveElement', | 369 return remoteCall.callRemoteTestUtil('getActiveElement', |
| 369 windowId, | 370 windowId, |
| 370 []); | 371 []); |
| 371 }).then(function(element) { | 372 }).then(function(element) { |
| 372 if (!element || !element.attributes['id']) | 373 if (!element || !element.attributes['id']) |
| 373 return false; | 374 return false; |
| 374 | 375 |
| 375 if (element.attributes['id'] === elementId) { | 376 if (element.attributes['id'] === elementId) { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 * @param {string} appId App id. | 497 * @param {string} appId App id. |
| 497 * @param {string} name File name to be selected. | 498 * @param {string} name File name to be selected. |
| 498 * @return {!Promise<boolean>} A promise which will be resolved with true if the | 499 * @return {!Promise<boolean>} A promise which will be resolved with true if the |
| 499 * thumbnail has clicked. This method does not guarantee whether the | 500 * thumbnail has clicked. This method does not guarantee whether the |
| 500 * thumbnail has actually selected or not. | 501 * thumbnail has actually selected or not. |
| 501 */ | 502 */ |
| 502 RemoteCallGallery.prototype.selectImageInThumbnailMode = function(appId, name) { | 503 RemoteCallGallery.prototype.selectImageInThumbnailMode = function(appId, name) { |
| 503 return this.callRemoteTestUtil('fakeMouseClick', appId, | 504 return this.callRemoteTestUtil('fakeMouseClick', appId, |
| 504 ['.thumbnail-view > ul > li[title="' + name + '"] > .selection.frame']); | 505 ['.thumbnail-view > ul > li[title="' + name + '"] > .selection.frame']); |
| 505 }; | 506 }; |
| OLD | NEW |