function createDirectoryFromDirectoryTree(
    useKeyboardShortcut, changeCurrentDirectory) {
  var windowId;
  return setupForDirectoryTreeContextMenuTest().then(function(id) {
    windowId = id;

    if (changeCurrentDirectory)
      return navigateWithDirectoryTree(windowId, '/photos');
    else
      return expandDownloadVolumeInDirectoryTree(windowId);
  }).then(function() {
    if (useKeyboardShortcut) {
      return remoteCall.callRemoteTestUtil('fakeKeyDown', windowId,
          ['body', 'e', 'U+0045' /* e */, true /* ctrl */, false, false]);
    } else {
      return clickDirectoryTreeContextMenuItem(
          windowId, '/photos', 'new-folder');
    }
  }).then(function() {
    return remoteCall.waitForElement(windowId, '.tree-row > input');
  }).then(function() {
    return remoteCall.callRemoteTestUtil(
        'inputText', windowId, ['.tree-row > input', 'test']);
  }).then(function() {
    return remoteCall.callRemoteTestUtil(
        'fakeKeyDown', windowId,
        ['.tree-row > input', 'Enter', 'Enter', false, false, false]);
  }).then(function() {
    // Confirm that new directory is added to the directory tree.
    return remoteCall.waitForElement(
        windowId, '[full-path-for-testing="/photos/test"]');
  }).then(function() {
    // Confirm that current directory is not changed at this timing.
    return remoteCall.waitUntilCurrentDirectoryIsChanged(
        windowId, changeCurrentDirectory ? '/Downloads/photos' : '/Downloads');
  }).then(function() {
    // Confirm that new directory is actually created by navigating to it.
    return navigateWithDirectoryTree(windowId, '/photos/test');
  });
}
/**
 * Creates directory from directory tree.
 */
Creates directory from directory tree.
Creates directory from directory tree .
function createDirectoryFromDirectoryTree(
    useKeyboardShortcut, changeCurrentDirectory) {
  var windowId;
  return setupForDirectoryTreeContextMenuTest().then(function(id) {
    windowId = id;
    if (changeCurrentDirectory)
      return navigateWithDirectoryTree(windowId, '/photos');
    else
      return expandDownloadVolumeInDirectoryTree(windowId);
  }).then(function() {
    if (useKeyboardShortcut) {
      return remoteCall.callRemoteTestUtil('fakeKeyDown', windowId,
          ['body', 'e', 'U+0045' , true , false, false]);
    } else {
      return clickDirectoryTreeContextMenuItem(
          windowId, '/photos', 'new-folder');
    }
  }).then(function() {
    return remoteCall.waitForElement(windowId, '.tree-row > input');
  }).then(function() {
    return remoteCall.callRemoteTestUtil(
        'inputText', windowId, ['.tree-row > input', 'test']);
  }).then(function() {
    return remoteCall.callRemoteTestUtil(
        'fakeKeyDown', windowId,
        ['.tree-row > input', 'Enter', 'Enter', false, false, false]);
  }).then(function() {
    return remoteCall.waitForElement(
        windowId, '[full-path-for-testing="/photos/test"]');
  }).then(function() {
    return remoteCall.waitUntilCurrentDirectoryIsChanged(
        windowId, changeCurrentDirectory ? '/Downloads/photos' : '/Downloads');
  }).then(function() {
    return navigateWithDirectoryTree(windowId, '/photos/test');
  });
}
function createDirectoryFromDirectoryTree ( useKeyboardShortcut , changeCurrentDirectory ) { var windowId ; return setupForDirectoryTreeContextMenuTest ( ) . then ( function ( id ) { windowId = id ; if ( changeCurrentDirectory ) return navigateWithDirectoryTree ( windowId , '/photos' ) ; else return expandDownloadVolumeInDirectoryTree ( windowId ) ; } ) . then ( function ( ) { if ( useKeyboardShortcut ) { return remoteCall . callRemoteTestUtil ( 'fakeKeyDown' , windowId , [ 'body' , 'e' , 'U+0045' , true , false , false ] ) ; } else { return clickDirectoryTreeContextMenuItem ( windowId , '/photos' , 'new-folder' ) ; } } ) . then ( function ( ) { return remoteCall . waitForElement ( windowId , '.tree-row > input' ) ; } ) . then ( function ( ) { return remoteCall . callRemoteTestUtil ( 'inputText' , windowId , [ '.tree-row > input' , 'test' ] ) ; } ) . then ( function ( ) { return remoteCall . callRemoteTestUtil ( 'fakeKeyDown' , windowId , [ '.tree-row > input' , 'Enter' , 'Enter' , false , false , false ] ) ; } ) . then ( function ( ) { return remoteCall . waitForElement ( windowId , '[full-path-for-testing="/photos/test"]' ) ; } ) . then ( function ( ) { return remoteCall . waitUntilCurrentDirectoryIsChanged ( windowId , changeCurrentDirectory ? '/Downloads/photos' : '/Downloads' ) ; } ) . then ( function ( ) { return navigateWithDirectoryTree ( windowId , '/photos/test' ) ; } ) ; }
Creates directory from directory tree.
Creates directory from directory tree .
/* e */ /* ctrl */ // Confirm that new directory is added to the directory tree. // Confirm that current directory is not changed at this timing. // Confirm that new directory is actually created by navigating to it.