function runTests() {
  chrome.test.runTests([
    // Executes an existing action.
    function executeActionSuccess() {
      var onExecuteActionRequested = chrome.test.callbackPass(
          function(options, onSuccess, onError) {
            chrome.test.assertEq(test_util.FILE_SYSTEM_ID,
                options.fileSystemId);
            chrome.test.assertEq(1, options.entryPaths.length);
            chrome.test.assertEq('/' + TESTING_ACTIONS_DIR.name,
                options.entryPaths[0]);
            chrome.test.assertEq(TESTING_ACTION_ID, options.actionId);
            chrome.fileSystemProvider.onExecuteActionRequested.removeListener(
                onExecuteActionRequested);
            onSuccess();
          });
      chrome.fileSystemProvider.onExecuteActionRequested.addListener(
          onExecuteActionRequested);
      test_util.fileSystem.root.getDirectory(
          TESTING_ACTIONS_DIR.name,
          {create: false},
          chrome.test.callbackPass(function(dirEntry) {
            chrome.fileManagerPrivate.executeCustomAction(
                [dirEntry],
                TESTING_ACTION_ID,
                chrome.test.callbackPass(function() {}));
          }),
          function(error) {
            chrome.test.fail(error.name);
          });
    },

    // Tries to execute a non-existing action.
    function executeNonExistingActionFailure() {
      var onExecuteActionRequested = chrome.test.callbackPass(
          function(options, onSuccess, onError) {
            chrome.test.assertEq(test_util.FILE_SYSTEM_ID,
                options.fileSystemId);
            chrome.test.assertEq(1, options.entryPaths.length);
            chrome.test.assertEq('/' + TESTING_ACTIONS_DIR.name,
                options.entryPaths[0]);
            chrome.test.assertEq(TESTING_UNKNOWN_ACTION_ID, options.actionId);
            chrome.fileSystemProvider.onExecuteActionRequested.removeListener(
                onExecuteActionRequested);
            onError('NOT_FOUND');
          });
      chrome.fileSystemProvider.onExecuteActionRequested.addListener(
          onExecuteActionRequested);
      test_util.fileSystem.root.getDirectory(
          TESTING_ACTIONS_DIR.name,
          {create: false},
          chrome.test.callbackPass(function(dirEntry) {
            chrome.fileManagerPrivate.executeCustomAction(
                [dirEntry],
                TESTING_UNKNOWN_ACTION_ID,
                chrome.test.callbackFail('Failed to execute the action.',
                    function() {}));
          }),
          function(error) {
            chrome.test.fail(error.name);
          });
    }
  ]);
}
/**
 * Runs all of the test cases, one by one.
 */
Runs all of the test cases, one by one.
Runs all of the test cases one by one .
function runTests() {
  chrome.test.runTests([
    function executeActionSuccess() {
      var onExecuteActionRequested = chrome.test.callbackPass(
          function(options, onSuccess, onError) {
            chrome.test.assertEq(test_util.FILE_SYSTEM_ID,
                options.fileSystemId);
            chrome.test.assertEq(1, options.entryPaths.length);
            chrome.test.assertEq('/' + TESTING_ACTIONS_DIR.name,
                options.entryPaths[0]);
            chrome.test.assertEq(TESTING_ACTION_ID, options.actionId);
            chrome.fileSystemProvider.onExecuteActionRequested.removeListener(
                onExecuteActionRequested);
            onSuccess();
          });
      chrome.fileSystemProvider.onExecuteActionRequested.addListener(
          onExecuteActionRequested);
      test_util.fileSystem.root.getDirectory(
          TESTING_ACTIONS_DIR.name,
          {create: false},
          chrome.test.callbackPass(function(dirEntry) {
            chrome.fileManagerPrivate.executeCustomAction(
                [dirEntry],
                TESTING_ACTION_ID,
                chrome.test.callbackPass(function() {}));
          }),
          function(error) {
            chrome.test.fail(error.name);
          });
    },
    function executeNonExistingActionFailure() {
      var onExecuteActionRequested = chrome.test.callbackPass(
          function(options, onSuccess, onError) {
            chrome.test.assertEq(test_util.FILE_SYSTEM_ID,
                options.fileSystemId);
            chrome.test.assertEq(1, options.entryPaths.length);
            chrome.test.assertEq('/' + TESTING_ACTIONS_DIR.name,
                options.entryPaths[0]);
            chrome.test.assertEq(TESTING_UNKNOWN_ACTION_ID, options.actionId);
            chrome.fileSystemProvider.onExecuteActionRequested.removeListener(
                onExecuteActionRequested);
            onError('NOT_FOUND');
          });
      chrome.fileSystemProvider.onExecuteActionRequested.addListener(
          onExecuteActionRequested);
      test_util.fileSystem.root.getDirectory(
          TESTING_ACTIONS_DIR.name,
          {create: false},
          chrome.test.callbackPass(function(dirEntry) {
            chrome.fileManagerPrivate.executeCustomAction(
                [dirEntry],
                TESTING_UNKNOWN_ACTION_ID,
                chrome.test.callbackFail('Failed to execute the action.',
                    function() {}));
          }),
          function(error) {
            chrome.test.fail(error.name);
          });
    }
  ]);
}
function runTests ( ) { chrome . test . runTests ( [ function executeActionSuccess ( ) { var onExecuteActionRequested = chrome . test . callbackPass ( function ( options , onSuccess , onError ) { chrome . test . assertEq ( test_util . FILE_SYSTEM_ID , options . fileSystemId ) ; chrome . test . assertEq ( 1 , options . entryPaths . length ) ; chrome . test . assertEq ( '/' + TESTING_ACTIONS_DIR . name , options . entryPaths [ 0 ] ) ; chrome . test . assertEq ( TESTING_ACTION_ID , options . actionId ) ; chrome . fileSystemProvider . onExecuteActionRequested . removeListener ( onExecuteActionRequested ) ; onSuccess ( ) ; } ) ; chrome . fileSystemProvider . onExecuteActionRequested . addListener ( onExecuteActionRequested ) ; test_util . fileSystem . root . getDirectory ( TESTING_ACTIONS_DIR . name , { create : false } , chrome . test . callbackPass ( function ( dirEntry ) { chrome . fileManagerPrivate . executeCustomAction ( [ dirEntry ] , TESTING_ACTION_ID , chrome . test . callbackPass ( function ( ) { } ) ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } , function executeNonExistingActionFailure ( ) { var onExecuteActionRequested = chrome . test . callbackPass ( function ( options , onSuccess , onError ) { chrome . test . assertEq ( test_util . FILE_SYSTEM_ID , options . fileSystemId ) ; chrome . test . assertEq ( 1 , options . entryPaths . length ) ; chrome . test . assertEq ( '/' + TESTING_ACTIONS_DIR . name , options . entryPaths [ 0 ] ) ; chrome . test . assertEq ( TESTING_UNKNOWN_ACTION_ID , options . actionId ) ; chrome . fileSystemProvider . onExecuteActionRequested . removeListener ( onExecuteActionRequested ) ; onError ( 'NOT_FOUND' ) ; } ) ; chrome . fileSystemProvider . onExecuteActionRequested . addListener ( onExecuteActionRequested ) ; test_util . fileSystem . root . getDirectory ( TESTING_ACTIONS_DIR . name , { create : false } , chrome . test . callbackPass ( function ( dirEntry ) { chrome . fileManagerPrivate . executeCustomAction ( [ dirEntry ] , TESTING_UNKNOWN_ACTION_ID , chrome . test . callbackFail ( 'Failed to execute the action.' , function ( ) { } ) ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } ] ) ; }
Runs all of the test cases, one by one.
Runs all of the test cases one by one .
// Executes an existing action. // Tries to execute a non-existing action.