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

Unified Diff: chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/test_util.js

Issue 332873008: Add gallery tests to rotate an image. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/slide_mode.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
+ });
+}
« no previous file with comments | « chrome/test/data/extensions/api_test/file_manager_browsertest/gallery/slide_mode.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698