function manage(path, expected_manage_url) {
  var appId;
  var caller = getCaller();
  StepsRunner.run([
    // Set up File Manager.
    function() {
      setupAndWaitUntilReady(null, RootPath.DRIVE, this.next);
    },
    // Select the source file.
    function(results) {
      appId = results.windowId;
      remoteCall.callRemoteTestUtil('selectFile', appId, [path], this.next);
    },
    // Wait for the file to be selected.
    function(result) {
      chrome.test.assertTrue(result);
      remoteCall.waitForElement(appId, '.table-row[selected]').then(this.next);
    },
    // Right-click on the file.
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall.callRemoteTestUtil(
          'fakeMouseRightClick', appId, ['.table-row[selected]'], this.next);
    },
    // Wait for the context menu to appear.
    function(result) {
      chrome.test.assertTrue(result);
      remoteCall.waitForElement(appId, '#file-context-menu:not([hidden])')
          .then(this.next);
    },
    // Wait for the "Manage in Drive" option to appear.
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall
          .waitForElement(
              appId,
              '[command="#manage-in-drive"]:not([hidden]):not([disabled])')
          .then(this.next);
    },
    // Select "Manage in Drive".
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall.callRemoteTestUtil(
          'fakeMouseClick', appId,
          ['[command="#manage-in-drive"]:not([hidden]):not([disabled])'],
          this.next);
    },
    // Wait for the context menu to disappear.
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall.waitForElement(appId, '#file-context-menu[hidden]')
          .then(this.next);
    },
    // Wait for the browser window to appear.
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall.callRemoteTestUtil('getLastVisitedURL', appId, [], this.next);
    },
    // Check we went to the correct URL, and for Javascript errors.
    function(visitedUrl) {
      chrome.test.assertEq(expected_manage_url, visitedUrl);
      checkIfNoErrorsOccured(this.next);
    }
  ]);
}
/**
 * Test clicking 'Manage in Drive' for a file or directory on Drive.
 *
 * @param {!string} path Path for a file or a directory to be shared.
 * @param {!string} expected_manage_url Expected URL for the browser to visit.
 */
Test clicking 'Manage in Drive' for a file or directory on Drive.
@param {!string} path Path for a file or a directory to be shared.
@param {!string} expected_manage_url Expected URL for the browser to visit.
Test clicking ' Manage in Drive ' for a file or directory on Drive . @param { !string } path Path for a file or a directory to be shared . @param { !string } expected_manage_url Expected URL for the browser to visit .
function manage(path, expected_manage_url) {
  var appId;
  var caller = getCaller();
  StepsRunner.run([
    function() {
      setupAndWaitUntilReady(null, RootPath.DRIVE, this.next);
    },
    function(results) {
      appId = results.windowId;
      remoteCall.callRemoteTestUtil('selectFile', appId, [path], this.next);
    },
    function(result) {
      chrome.test.assertTrue(result);
      remoteCall.waitForElement(appId, '.table-row[selected]').then(this.next);
    },
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall.callRemoteTestUtil(
          'fakeMouseRightClick', appId, ['.table-row[selected]'], this.next);
    },
    function(result) {
      chrome.test.assertTrue(result);
      remoteCall.waitForElement(appId, '#file-context-menu:not([hidden])')
          .then(this.next);
    },
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall
          .waitForElement(
              appId,
              '[command="#manage-in-drive"]:not([hidden]):not([disabled])')
          .then(this.next);
    },
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall.callRemoteTestUtil(
          'fakeMouseClick', appId,
          ['[command="#manage-in-drive"]:not([hidden]):not([disabled])'],
          this.next);
    },
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall.waitForElement(appId, '#file-context-menu[hidden]')
          .then(this.next);
    },
    function(result) {
      chrome.test.assertTrue(!!result);
      remoteCall.callRemoteTestUtil('getLastVisitedURL', appId, [], this.next);
    },
    function(visitedUrl) {
      chrome.test.assertEq(expected_manage_url, visitedUrl);
      checkIfNoErrorsOccured(this.next);
    }
  ]);
}
function manage ( path , expected_manage_url ) { var appId ; var caller = getCaller ( ) ; StepsRunner . run ( [ function ( ) { setupAndWaitUntilReady ( null , RootPath . DRIVE , this . next ) ; } , function ( results ) { appId = results . windowId ; remoteCall . callRemoteTestUtil ( 'selectFile' , appId , [ path ] , this . next ) ; } , function ( result ) { chrome . test . assertTrue ( result ) ; remoteCall . waitForElement ( appId , '.table-row[selected]' ) . then ( this . next ) ; } , function ( result ) { chrome . test . assertTrue ( ! ! result ) ; remoteCall . callRemoteTestUtil ( 'fakeMouseRightClick' , appId , [ '.table-row[selected]' ] , this . next ) ; } , function ( result ) { chrome . test . assertTrue ( result ) ; remoteCall . waitForElement ( appId , '#file-context-menu:not([hidden])' ) . then ( this . next ) ; } , function ( result ) { chrome . test . assertTrue ( ! ! result ) ; remoteCall . waitForElement ( appId , '[command="#manage-in-drive"]:not([hidden]):not([disabled])' ) . then ( this . next ) ; } , function ( result ) { chrome . test . assertTrue ( ! ! result ) ; remoteCall . callRemoteTestUtil ( 'fakeMouseClick' , appId , [ '[command="#manage-in-drive"]:not([hidden]):not([disabled])' ] , this . next ) ; } , function ( result ) { chrome . test . assertTrue ( ! ! result ) ; remoteCall . waitForElement ( appId , '#file-context-menu[hidden]' ) . then ( this . next ) ; } , function ( result ) { chrome . test . assertTrue ( ! ! result ) ; remoteCall . callRemoteTestUtil ( 'getLastVisitedURL' , appId , [ ] , this . next ) ; } , function ( visitedUrl ) { chrome . test . assertEq ( expected_manage_url , visitedUrl ) ; checkIfNoErrorsOccured ( this . next ) ; } ] ) ; }
Test clicking 'Manage in Drive' for a file or directory on Drive.
Test clicking ' Manage in Drive ' for a file or directory on Drive .
// Set up File Manager. // Select the source file. // Wait for the file to be selected. // Right-click on the file. // Wait for the context menu to appear. // Wait for the "Manage in Drive" option to appear. // Select "Manage in Drive". // Wait for the context menu to disappear. // Wait for the browser window to appear. // Check we went to the correct URL, and for Javascript errors.