| Index: chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_util.js
|
| diff --git a/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_util.js b/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_util.js
|
| index 3dcf3cd7d7937519af020c22d72b397e8c867ad7..a140cc637398c5cfb07e45dbde0b425e15851198 100644
|
| --- a/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_util.js
|
| +++ b/chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_util.js
|
| @@ -71,3 +71,44 @@ function launchWithTestEntries(
|
| });
|
| });
|
| }
|
| +
|
| +/**
|
| + * Waits until the expected image is shown.
|
| + *
|
| + * @param {document} document Document.
|
| + * @param {number} width Expected width of the image.
|
| + * @param {number} height Expected height of the image.
|
| + * @param {string} name Expected name of the image.
|
| + * @return {Promise} Promsie to be fulfilled when the check is passed.
|
| + */
|
| +function waitForSlideImage(document, width, height, name) {
|
| + var expected = {width: width, height: height, name: name};
|
| + return repeatUntil(function() {
|
| + var fullResCanvas = document.querySelector(
|
| + '.gallery[mode="slide"] .content canvas.fullres');
|
| + var nameBox = document.querySelector('.namebox');
|
| + var actual = {
|
| + width: fullResCanvas && fullResCanvas.width,
|
| + height: fullResCanvas && fullResCanvas.height,
|
| + name: nameBox && nameBox.value
|
| + };
|
| + if (!chrome.test.checkDeepEq(expected, actual)) {
|
| + return pending('Slide mode state, expected is %j, actual is %j.',
|
| + expected, actual);
|
| + }
|
| + return actual;
|
| + });
|
| +}
|
| +
|
| +/**
|
| + * Shorthand for clicking an element.
|
| + * @param {AppWindow} appWindow application window.
|
| + * @param {string} query Query for the element.
|
| + * @param {Promise} Promise to be fulfilled with the clicked element.
|
| + */
|
| +function waitAndClickElement(appWindow, query) {
|
| + return waitForElement(appWindow, query).then(function(element) {
|
| + element.click();
|
| + return element;
|
| + });
|
| +}
|
|
|