Commit c0903e17 authored by hirono@chromium.org's avatar hirono@chromium.org

Gallery: Fix undo of cropping images.

The CL also updates the browser test to handle the case.

BUG=401314
TEST=manually and run the test

Review URL: https://codereview.chromium.org/448973003

Cr-Commit-Position: refs/heads/master@{#288300}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288300 0039d316-1c4b-4281-b951-d872f2087c98
parent c00af75b
......@@ -28,12 +28,14 @@ function waitForPressEnterMessage(appWindow) {
*/
function setupPhotoEditor(testVolumeName, volumeType) {
// Lauch the gallery.
observeWindowError(window);
var launchedPromise = launchWithTestEntries(
testVolumeName,
volumeType,
[ENTRIES.desktop]);
return launchedPromise.then(function(args) {
var appWindow = args.appWindow;
observeWindowError(appWindow.contentWindow);
// Show the slide image.
var slideImagePromise = waitForSlideImage(
......@@ -90,7 +92,7 @@ function rotateImage(testVolumeName, volumeType) {
}
/**
* Tests to crop an image.
* Tests to crop an image and undoes it.
*
* @param {string} testVolumeName Test volume name passed to the addEntries
* function. Either 'drive' or 'local'.
......@@ -123,6 +125,17 @@ function cropImage(testVolumeName, volumeType) {
533,
400,
'My Desktop Background');
}).
then(function() {
return waitAndClickElement(
appWindow, '.gallery:not([locked]) button.undo');
}).
then(function() {
return waitForSlideImage(
appWindow.contentWindow.document,
800,
600,
'My Desktop Background');
});
});
}
......
......@@ -145,3 +145,13 @@ function sendKeyDown(appWindow, query, keyIdentifier) {
'keydown',
{bubbles: true, keyIdentifier: keyIdentifier}));
}
/**
* Observes window errors that should fail the browser tests.
* @param {DOMWindow} window Windows to be obserbed.
*/
function observeWindowError(window) {
window.onerror = function(error) {
chrome.test.fail('window.onerror: ' + error);
};
}
......@@ -643,7 +643,7 @@ ImageView.prototype.animateAndReplace = function(canvas, imageCropRect) {
imageCropRect);
// Animate to the transformed state.
this.setTransform_(oldScreenImage, this,viewport_, effect);
this.setTransform_(oldScreenImage, this.viewport_, effect);
setTimeout(setFade.bind(null, false), 0);
setTimeout(function() {
if (oldScreenImage.parentNode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment