Index: ui/file_manager/integration_tests/gallery/photo_editor.js |
diff --git a/ui/file_manager/integration_tests/gallery/photo_editor.js b/ui/file_manager/integration_tests/gallery/photo_editor.js |
index 0427a3aee512ae3884b722ec5c12924a00d0eec0..e13bf2d4e051354d9229df4980f31277ad60fa33 100644 |
--- a/ui/file_manager/integration_tests/gallery/photo_editor.js |
+++ b/ui/file_manager/integration_tests/gallery/photo_editor.js |
@@ -137,7 +137,6 @@ function exposureImage(testVolumeName, volumeType) { |
var appId = args.appId; |
var url = args.urls[0]; |
var buttonQuery = '.gallery:not([locked]) button.exposure'; |
- |
var origMetadata = null; |
// Click the exposure button. |
@@ -183,6 +182,76 @@ function exposureImage(testVolumeName, volumeType) { |
} |
/** |
+ * Tests to resize an image and undoes it. |
+ * |
+ * @param {string} testVolumeName Test volume name passed to the addEntries |
+ * function. Either 'drive' or 'local' |
+ * @param {VolumeManagerCommon.VolumeType} volumeType Volume type. |
+ * @return {Promise} Promise to be fulfilled with on success. |
+ */ |
+function resizeImage(testVolumeName, volumeType) { |
+ var launchedPromise = setupPhotoEditor(testVolumeName, volumeType); |
+ return launchedPromise.then(function(args) { |
+ var appId = args.appId; |
+ |
+ return gallery.waitAndClickElement( |
+ appId, '.gallery:not([locked]) button.resize'). |
+ then(function() { |
+ return Promise.all([ |
+ gallery.waitForElement(appId, '.width > paper-input'), |
+ gallery.waitForElement(appId, '.height > paper-input'), |
+ gallery.waitForElement(appId, 'paper-checkbox.ratio-fixed'), |
+ ]); |
+ }).then(function() { |
+ return gallery.callRemoteTestUtil( |
+ 'changeValue', appId, ['.height > paper-input', 500]); |
+ }).then(function() { |
+ return gallery.fakeKeyDown( |
+ appId, 'body', 'Enter', 'Enter', false, false, false); |
+ }).then(function() { |
+ return gallery.waitForSlideImage(appId, 666, 500, |
+ 'My Desktop Background'); |
+ }).then(function() { |
+ return gallery.waitAndClickElement( |
+ appId, '.gallery:not([locked]) button.undo'); |
+ }).then(function() { |
+ return gallery.waitForSlideImage(appId, 800, 600, |
+ 'My Desktop Background'); |
+ }).then(function() { |
+ return gallery.waitAndClickElement( |
+ appId, '.gallery:not([locked]) button.resize'); |
+ }).then(function() { |
+ return Promise.all([ |
+ gallery.waitForElement(appId, '.width > paper-input'), |
+ gallery.waitForElement(appId, '.height > paper-input'), |
+ gallery.waitForElement(appId, 'paper-checkbox.ratio-fixed'), |
+ ]); |
+ }).then(function() { |
+ return gallery.waitAndClickElement( |
+ appId, '.gallery:not([locked]) paper-checkbox.ratio-fixed'); |
+ }).then(function() { |
+ return gallery.callRemoteTestUtil( |
+ 'changeValue', appId, ['.width > paper-input', 500]); |
+ }).then(function() { |
+ return gallery.callRemoteTestUtil( |
+ 'changeValue', appId, ['.height > paper-input', 300]); |
+ }).then(function() { |
+ return gallery.fakeKeyDown( |
+ appId, 'body', 'Enter', 'Enter', false, false, false); |
+ }).then(function() { |
+ return gallery.waitForSlideImage(appId, 500, 300, |
+ 'My Desktop Background'); |
+ }).then(function() { |
+ return gallery.waitAndClickElement( |
+ appId, '.gallery:not([locked]) button.undo'); |
+ }).then(function() { |
+ return gallery.waitForSlideImage(appId, 800, 600, |
+ 'My Desktop Background'); |
+ }); |
+ }); |
+} |
+ |
+/** |
* Tests whether overwrite original checkbox is enabled or disabled properly. |
* |
* @param {string} testVolumeName Test volume name passed to the addEntries |
@@ -293,6 +362,22 @@ testcase.exposureImageOnDrive = function() { |
}; |
/** |
+ * The resize test for Downloas. |
+ * @return {Promise} Promise to be fulfilled with on success. |
+ */ |
+testcase.resizeImageOnDownloads = function() { |
+ return resizeImage('local', 'downloads'); |
+}; |
+ |
+/** |
+ * The resize test for Google Drive |
+ * @return {Promise} Promise to be fulfilled with on success. |
+ */ |
+testcase.resizeImageOnDrive = function() { |
+ return resizeImage('drive', 'drive'); |
+} |
+ |
+/** |
* The enableDisableOverwriteOriginalCheckbox test for Downloads. |
* @return {Promise} Promise to be fulfilled with on success. |
*/ |