function runTests() {
  chrome.test.runTests([
    // Create a file which doesn't exist. Should succeed.
    function createFileSuccessSimple() {
      test_util.fileSystem.root.getFile(
          TESTING_NEW_FILE.name, {create: true},
          chrome.test.callbackPass(function(entry) {
            chrome.test.assertEq(TESTING_NEW_FILE.name, entry.name);
            chrome.test.assertFalse(entry.isDirectory);
          }), function(error) {
            chrome.test.fail(error.name);
          });
    },

    // Create a file which exists, non-exclusively. Should succeed.
    function createFileOrOpenSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_FILE.name, {create: true, exclusive: false},
          chrome.test.callbackPass(function(entry) {
            chrome.test.assertEq(TESTING_FILE.name, entry.name);
            chrome.test.assertFalse(entry.isDirectory);
          }), function(error) {
            chrome.test.fail(error.name);
          });
    },

    // Create a file which exists, exclusively. Should fail.
    function createFileExistsError() {
      test_util.fileSystem.root.getFile(
          TESTING_FILE.name, {create: true, exclusive: true},
          function(entry) {
            chrome.test.fail('Created a file, but should fail.');
          }, chrome.test.callbackPass(function(error) {
            chrome.test.assertEq('InvalidModificationError', 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 createFileSuccessSimple() {
      test_util.fileSystem.root.getFile(
          TESTING_NEW_FILE.name, {create: true},
          chrome.test.callbackPass(function(entry) {
            chrome.test.assertEq(TESTING_NEW_FILE.name, entry.name);
            chrome.test.assertFalse(entry.isDirectory);
          }), function(error) {
            chrome.test.fail(error.name);
          });
    },
    function createFileOrOpenSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_FILE.name, {create: true, exclusive: false},
          chrome.test.callbackPass(function(entry) {
            chrome.test.assertEq(TESTING_FILE.name, entry.name);
            chrome.test.assertFalse(entry.isDirectory);
          }), function(error) {
            chrome.test.fail(error.name);
          });
    },
    function createFileExistsError() {
      test_util.fileSystem.root.getFile(
          TESTING_FILE.name, {create: true, exclusive: true},
          function(entry) {
            chrome.test.fail('Created a file, but should fail.');
          }, chrome.test.callbackPass(function(error) {
            chrome.test.assertEq('InvalidModificationError', error.name);
          }));
    }
  ]);
}
function runTests ( ) { chrome . test . runTests ( [ function createFileSuccessSimple ( ) { test_util . fileSystem . root . getFile ( TESTING_NEW_FILE . name , { create : true } , chrome . test . callbackPass ( function ( entry ) { chrome . test . assertEq ( TESTING_NEW_FILE . name , entry . name ) ; chrome . test . assertFalse ( entry . isDirectory ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } , function createFileOrOpenSuccess ( ) { test_util . fileSystem . root . getFile ( TESTING_FILE . name , { create : true , exclusive : false } , chrome . test . callbackPass ( function ( entry ) { chrome . test . assertEq ( TESTING_FILE . name , entry . name ) ; chrome . test . assertFalse ( entry . isDirectory ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } , function createFileExistsError ( ) { test_util . fileSystem . root . getFile ( TESTING_FILE . name , { create : true , exclusive : true } , function ( entry ) { chrome . test . fail ( 'Created a file, but should fail.' ) ; } , chrome . test . callbackPass ( function ( error ) { chrome . test . assertEq ( 'InvalidModificationError' , error . name ) ; } ) ) ; } ] ) ; }
Runs all of the test cases, one by one.
Runs all of the test cases one by one .
// Create a file which doesn't exist. Should succeed. // Create a file which exists, non-exclusively. Should succeed. // Create a file which exists, exclusively. Should fail.