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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 return repeatUntil(function() { | 325 return repeatUntil(function() { |
326 return this.callRemoteTestUtil('getExecutedTasks', windowId, []). | 326 return this.callRemoteTestUtil('getExecutedTasks', windowId, []). |
327 then(function(executedTasks) { | 327 then(function(executedTasks) { |
328 if (executedTasks.indexOf(taskId) === -1) | 328 if (executedTasks.indexOf(taskId) === -1) |
329 return pending('Executed task is %j', executedTasks); | 329 return pending('Executed task is %j', executedTasks); |
330 }); | 330 }); |
331 }.bind(this)); | 331 }.bind(this)); |
332 }; | 332 }; |
333 | 333 |
334 /** | 334 /** |
| 335 * Check if the next tabforcus'd element has the given ID or not. |
| 336 * @param {string} windowId Target window ID. |
| 337 * @param {string} elementId String of 'id' attribute which the next tabfocus'd |
| 338 * element should have. |
| 339 * @return {Promise} Promise to be fulfilled with the result. |
| 340 */ |
| 341 RemoteCallFilesApp.prototype.checkNextTabFocus = |
| 342 function(windowId, elementId) { |
| 343 return remoteCall.callRemoteTestUtil('fakeKeyDown', |
| 344 windowId, |
| 345 ['body', 'U+0009', false]).then( |
| 346 function(result) { |
| 347 chrome.test.assertTrue(result); |
| 348 return remoteCall.callRemoteTestUtil('getActiveElement', |
| 349 windowId, |
| 350 []); |
| 351 }).then(function(element) { |
| 352 if (!element || !element.attributes['id']) |
| 353 return false; |
| 354 |
| 355 if (element.attributes['id'] === elementId) { |
| 356 return true; |
| 357 } else { |
| 358 console.error('The ID of the element should be "' + elementId + |
| 359 '", but "' + element.attributes['id'] + '"'); |
| 360 return false; |
| 361 } |
| 362 }); |
| 363 }; |
| 364 |
| 365 /** |
335 * Waits until the current directory is changed. | 366 * Waits until the current directory is changed. |
336 * @param {string} windowId Target window ID. | 367 * @param {string} windowId Target window ID. |
337 * @param {string} expectedPath Path to be changed to. | 368 * @param {string} expectedPath Path to be changed to. |
338 * @return {Promise} Promise to be fulfilled when the current directory is | 369 * @return {Promise} Promise to be fulfilled when the current directory is |
339 * changed to expectedPath. | 370 * changed to expectedPath. |
340 */ | 371 */ |
341 RemoteCallFilesApp.prototype.waitUntilCurrentDirectoryIsChanged = | 372 RemoteCallFilesApp.prototype.waitUntilCurrentDirectoryIsChanged = |
342 function(windowId, expectedPath) { | 373 function(windowId, expectedPath) { |
343 return repeatUntil(function () { | 374 return repeatUntil(function () { |
344 return this.callRemoteTestUtil('getBreadcrumbPath', windowId, []).then( | 375 return this.callRemoteTestUtil('getBreadcrumbPath', windowId, []).then( |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 * @param {AppWindow} appWindow App window. | 463 * @param {AppWindow} appWindow App window. |
433 * @return {Promise} Promise to be fulfilled when the element appears. | 464 * @return {Promise} Promise to be fulfilled when the element appears. |
434 */ | 465 */ |
435 RemoteCallGallery.prototype.waitForPressEnterMessage = function(appId) { | 466 RemoteCallGallery.prototype.waitForPressEnterMessage = function(appId) { |
436 return this.waitForElement(appId, '.prompt-wrapper .prompt'). | 467 return this.waitForElement(appId, '.prompt-wrapper .prompt'). |
437 then(function(element) { | 468 then(function(element) { |
438 chrome.test.assertEq( | 469 chrome.test.assertEq( |
439 'Press Enter when done', element.text.trim()); | 470 'Press Enter when done', element.text.trim()); |
440 }); | 471 }); |
441 }; | 472 }; |
OLD | NEW |