function cropImage(testVolumeName, volumeType) {
  var launchedPromise = setupPhotoEditor(testVolumeName, volumeType);
  return launchedPromise.then(function(args) {
    var appId = args.appId;
    return gallery.waitAndClickElement(appId,
                                       '.gallery:not([locked]) button.crop').
        then(function() {
          return Promise.all([
            gallery.waitForElement(appId, '.crop-overlay')
          ]);
        }).
        then(function() {
          return gallery.fakeKeyDown(
              appId, 'body', 'Enter', 'Enter', false, false, false);
        }).
        then(function(ret) {
          chrome.test.assertTrue(ret);
          return Promise.all([
            gallery.waitForElementLost(appId, '.crop-overlay')
          ]);
        }).
        then(function() {
          return gallery.waitForSlideImage(
              appId,
              534,
              400,
              '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 to crop 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.
 */
Tests to crop an image and undoes it.
@param {string} testVolumeName Test volume name passed to the addEntries
function. Either 'drive' or 'local'.
Tests to crop an image and undoes it . @param { string } testVolumeName Test volume name passed to the addEntries function . Either ' drive ' or ' local ' .
function cropImage(testVolumeName, volumeType) {
  var launchedPromise = setupPhotoEditor(testVolumeName, volumeType);
  return launchedPromise.then(function(args) {
    var appId = args.appId;
    return gallery.waitAndClickElement(appId,
                                       '.gallery:not([locked]) button.crop').
        then(function() {
          return Promise.all([
            gallery.waitForElement(appId, '.crop-overlay')
          ]);
        }).
        then(function() {
          return gallery.fakeKeyDown(
              appId, 'body', 'Enter', 'Enter', false, false, false);
        }).
        then(function(ret) {
          chrome.test.assertTrue(ret);
          return Promise.all([
            gallery.waitForElementLost(appId, '.crop-overlay')
          ]);
        }).
        then(function() {
          return gallery.waitForSlideImage(
              appId,
              534,
              400,
              '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');
        });
  });
}
function cropImage ( testVolumeName , volumeType ) { var launchedPromise = setupPhotoEditor ( testVolumeName , volumeType ) ; return launchedPromise . then ( function ( args ) { var appId = args . appId ; return gallery . waitAndClickElement ( appId , '.gallery:not([locked]) button.crop' ) . then ( function ( ) { return Promise . all ( [ gallery . waitForElement ( appId , '.crop-overlay' ) ] ) ; } ) . then ( function ( ) { return gallery . fakeKeyDown ( appId , 'body' , 'Enter' , 'Enter' , false , false , false ) ; } ) . then ( function ( ret ) { chrome . test . assertTrue ( ret ) ; return Promise . all ( [ gallery . waitForElementLost ( appId , '.crop-overlay' ) ] ) ; } ) . then ( function ( ) { return gallery . waitForSlideImage ( appId , 534 , 400 , '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 to crop an image and undoes it.
Tests to crop an image and undoes it .