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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 function(windowId, width, height, name) { | 424 function(windowId, width, height, name) { |
425 var expected = {}; | 425 var expected = {}; |
426 if (width) | 426 if (width) |
427 expected.width = width; | 427 expected.width = width; |
428 if (height) | 428 if (height) |
429 expected.height = height; | 429 expected.height = height; |
430 if (name) | 430 if (name) |
431 expected.name = name; | 431 expected.name = name; |
432 | 432 |
433 return repeatUntil(function() { | 433 return repeatUntil(function() { |
434 var query = '.gallery[mode="slide"] .content canvas.fullres'; | 434 var query = '.gallery[mode="slide"] .image-container > .image'; |
435 return Promise.all([ | 435 return Promise.all([ |
436 this.waitForElement(windowId, '.filename-spacer input'), | 436 this.waitForElement(windowId, '.filename-spacer input'), |
437 this.waitForElement(windowId, query) | 437 this.waitForElement(windowId, query) |
438 ]).then(function(args) { | 438 ]).then(function(args) { |
439 var nameBox = args[0]; | 439 var nameBox = args[0]; |
440 var fullResCanvas = args[1]; | 440 var image = args[1]; |
441 var actual = {}; | 441 var actual = {}; |
442 if (width && fullResCanvas) | 442 if (width && image) |
443 actual.width = Number(fullResCanvas.attributes.width); | 443 actual.width = image.imageWidth; |
444 if (height && fullResCanvas) | 444 if (height && image) |
445 actual.height = Number(fullResCanvas.attributes.height); | 445 actual.height = image.imageHeight; |
446 if (name && nameBox) | 446 if (name && nameBox) |
447 actual.name = nameBox.value; | 447 actual.name = nameBox.value; |
448 | 448 |
449 if (!chrome.test.checkDeepEq(expected, actual)) { | 449 if (!chrome.test.checkDeepEq(expected, actual)) { |
450 return pending('Slide mode state, expected is %j, actual is %j.', | 450 return pending('Slide mode state, expected is %j, actual is %j.', |
451 expected, actual); | 451 expected, actual); |
452 } | 452 } |
453 return actual; | 453 return actual; |
454 }); | 454 }); |
455 }.bind(this)); | 455 }.bind(this)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 * @param {string} appId App id. | 494 * @param {string} appId App id. |
495 * @param {string} name File name to be selected. | 495 * @param {string} name File name to be selected. |
496 * @return {!Promise<boolean>} A promise which will be resolved with true if the | 496 * @return {!Promise<boolean>} A promise which will be resolved with true if the |
497 * thumbnail has clicked. This method does not guarantee whether the | 497 * thumbnail has clicked. This method does not guarantee whether the |
498 * thumbnail has actually selected or not. | 498 * thumbnail has actually selected or not. |
499 */ | 499 */ |
500 RemoteCallGallery.prototype.selectImageInThumbnailMode = function(appId, name) { | 500 RemoteCallGallery.prototype.selectImageInThumbnailMode = function(appId, name) { |
501 return this.callRemoteTestUtil('fakeMouseClick', appId, | 501 return this.callRemoteTestUtil('fakeMouseClick', appId, |
502 ['.thumbnail-view > ul > li[title="' + name + '"] > .selection.frame']); | 502 ['.thumbnail-view > ul > li[title="' + name + '"] > .selection.frame']); |
503 }; | 503 }; |
OLD | NEW |