function tabindexFocus(dialogParams, volumeName, expectedSet, initialize,
                       initialElements, expectedTabOrder) {
  var localEntriesPromise = addEntries(['local'], BASIC_LOCAL_ENTRY_SET);
  var driveEntriesPromise = addEntries(['drive'], BASIC_DRIVE_ENTRY_SET);
  var setupPromise = Promise.all([localEntriesPromise, driveEntriesPromise]);

  var selectAndCheckAndClose = function(appId) {
    var promise = Promise.resolve();

    if (dialogParams.type === 'saveFile') {
      promise = promise.then(function() {
        return remoteCall.waitForElement(
            appId, ['#filename-input-textbox:focus']);
      });
    } else {
      promise = promise.then(function() {
        return remoteCall.waitForElement(appId, ['#file-list:focus']);
      });
    }

    if (initialize)
      promise = promise.then(initialize.bind(null, appId));

    // Waits for the initial element.
    promise = promise.then(function() {
      return Promise.all(initialElements.map(function(selector) {
        return remoteCall.waitForElement(appId, [selector]);
      }));
    });

    // Checks tabfocus.
    expectedTabOrder.forEach(function(className) {
      promise = promise.then(function() {
        return remoteCall.checkNextTabFocus(appId, className);
      }).then(function(result) {
        chrome.test.assertTrue(result);
      });
    });

    promise = promise.then(function() {
      // Closes the window by pressing Enter.
      return remoteCall.callRemoteTestUtil(
          'fakeKeyDown', appId, ['#file-list', 'Enter', 'Enter', false, false,
                                 false]);
    });

    return promise;
  };

  return setupPromise.then(function() {
    return openAndWaitForClosingDialog(
        dialogParams, volumeName, expectedSet, selectAndCheckAndClose);
  });
}
/**
 * Tests the tab focus in the dialog and closes the dialog.
 *
 * @param {!Object} dialogParams Dialog parameters to be passed to
 *     chrome.fileSystem.chooseEntry.
 * @param {string} volumeName Volume name passed to the selectVolume remote
 *     function.
 * @param {!Array<TestEntryInfo>} expectedSet Expected set of the entries.
 * @param {?function(string):(!Promise|Object)} initialize Initialization before
 *     test runs. The window ID is passed as an argument. If null, do nothing as
 *     initialization.
 * @param {!Array<string>} initialElements Selectors of the elements which
 *     shows the Files app is ready. After all the elements show up, the
 *     tabfocus tests starts.
 * @param {Array<string>} expectedTabOrder Array with the IDs of the element
 *     with the corresponding order of expected tab-indexes.
 */
Tests the tab focus in the dialog and closes the dialog.
@param {!Object} dialogParams Dialog parameters to be passed to
chrome.fileSystem.chooseEntry.
@param {string} volumeName Volume name passed to the selectVolume remote
function.
@param {!Array} expectedSet Expected set of the entries.
@param {?function(string):(!Promise|Object)} initialize Initialization before
test runs. The window ID is passed as an argument. If null, do nothing as
initialization.
@param {!Array} initialElements Selectors of the elements which
shows the Files app is ready. After all the elements show up, the
tabfocus tests starts.
@param {Array} expectedTabOrder Array with the IDs of the element
with the corresponding order of expected tab-indexes.
Tests the tab focus in the dialog and closes the dialog . @param { !Object } dialogParams Dialog parameters to be passed to chrome . fileSystem . chooseEntry . @param { string } volumeName Volume name passed to the selectVolume remote function . @param { !Array } expectedSet Expected set of the entries . @param { ?function ( string ) : ( !Promise|Object ) } initialize Initialization before test runs . The window ID is passed as an argument . If null do nothing as initialization . @param { !Array } initialElements Selectors of the elements which shows the Files app is ready . After all the elements show up the tabfocus tests starts . @param { Array } expectedTabOrder Array with the IDs of the element with the corresponding order of expected tab - indexes .
function tabindexFocus(dialogParams, volumeName, expectedSet, initialize,
                       initialElements, expectedTabOrder) {
  var localEntriesPromise = addEntries(['local'], BASIC_LOCAL_ENTRY_SET);
  var driveEntriesPromise = addEntries(['drive'], BASIC_DRIVE_ENTRY_SET);
  var setupPromise = Promise.all([localEntriesPromise, driveEntriesPromise]);
  var selectAndCheckAndClose = function(appId) {
    var promise = Promise.resolve();
    if (dialogParams.type === 'saveFile') {
      promise = promise.then(function() {
        return remoteCall.waitForElement(
            appId, ['#filename-input-textbox:focus']);
      });
    } else {
      promise = promise.then(function() {
        return remoteCall.waitForElement(appId, ['#file-list:focus']);
      });
    }
    if (initialize)
      promise = promise.then(initialize.bind(null, appId));
    promise = promise.then(function() {
      return Promise.all(initialElements.map(function(selector) {
        return remoteCall.waitForElement(appId, [selector]);
      }));
    });
    expectedTabOrder.forEach(function(className) {
      promise = promise.then(function() {
        return remoteCall.checkNextTabFocus(appId, className);
      }).then(function(result) {
        chrome.test.assertTrue(result);
      });
    });
    promise = promise.then(function() {
      return remoteCall.callRemoteTestUtil(
          'fakeKeyDown', appId, ['#file-list', 'Enter', 'Enter', false, false,
                                 false]);
    });
    return promise;
  };
  return setupPromise.then(function() {
    return openAndWaitForClosingDialog(
        dialogParams, volumeName, expectedSet, selectAndCheckAndClose);
  });
}
function tabindexFocus ( dialogParams , volumeName , expectedSet , initialize , initialElements , expectedTabOrder ) { var localEntriesPromise = addEntries ( [ 'local' ] , BASIC_LOCAL_ENTRY_SET ) ; var driveEntriesPromise = addEntries ( [ 'drive' ] , BASIC_DRIVE_ENTRY_SET ) ; var setupPromise = Promise . all ( [ localEntriesPromise , driveEntriesPromise ] ) ; var selectAndCheckAndClose = function ( appId ) { var promise = Promise . resolve ( ) ; if ( dialogParams . type === 'saveFile' ) { promise = promise . then ( function ( ) { return remoteCall . waitForElement ( appId , [ '#filename-input-textbox:focus' ] ) ; } ) ; } else { promise = promise . then ( function ( ) { return remoteCall . waitForElement ( appId , [ '#file-list:focus' ] ) ; } ) ; } if ( initialize ) promise = promise . then ( initialize . bind ( null , appId ) ) ; promise = promise . then ( function ( ) { return Promise . all ( initialElements . map ( function ( selector ) { return remoteCall . waitForElement ( appId , [ selector ] ) ; } ) ) ; } ) ; expectedTabOrder . forEach ( function ( className ) { promise = promise . then ( function ( ) { return remoteCall . checkNextTabFocus ( appId , className ) ; } ) . then ( function ( result ) { chrome . test . assertTrue ( result ) ; } ) ; } ) ; promise = promise . then ( function ( ) { return remoteCall . callRemoteTestUtil ( 'fakeKeyDown' , appId , [ '#file-list' , 'Enter' , 'Enter' , false , false , false ] ) ; } ) ; return promise ; } ; return setupPromise . then ( function ( ) { return openAndWaitForClosingDialog ( dialogParams , volumeName , expectedSet , selectAndCheckAndClose ) ; } ) ; }
Tests the tab focus in the dialog and closes the dialog.
Tests the tab focus in the dialog and closes the dialog .
// Waits for the initial element. // Checks tabfocus. // Closes the window by pressing Enter.