function runTests() {
  chrome.test.runTests([
    // Move an existing file to a non-existing destination. Should succeed.
    function moveEntrySuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_FILE.name, {create: false},
          chrome.test.callbackPass(function(sourceEntry) {
            chrome.test.assertEq(TESTING_FILE.name, sourceEntry.name);
            chrome.test.assertFalse(sourceEntry.isDirectory);
            sourceEntry.moveTo(
                test_util.fileSystem.root,
                TESTING_NEW_FILE_NAME,
                chrome.test.callbackPass(function(targetEntry) {
                  chrome.test.assertEq(TESTING_NEW_FILE_NAME, targetEntry.name);
                  chrome.test.assertFalse(targetEntry.isDirectory);
                  // The source file should be deleted.
                  test_util.fileSystem.root.getFile(
                      TESTING_FILE.name, {create: false},
                      function(newSourceEntry) {
                        chrome.test.fail('Source file not deleted.');
                      },
                      chrome.test.callbackPass(function(error) {
                        chrome.test.assertEq('NotFoundError', error.name);
                      }))
                }), function(error) {
                  chrome.test.fail(error.name);
                });
          }), function(error) {
            chrome.test.fail(error.name);
          });
    },

    // Move an existing file to a location which already holds a file.
    // Should fail.
    function moveEntryExistsError() {
      test_util.fileSystem.root.getFile(
          TESTING_ANOTHER_FILE.name, {create: false},
          chrome.test.callbackPass(function(sourceEntry) {
            chrome.test.assertEq(TESTING_ANOTHER_FILE.name, sourceEntry.name);
            chrome.test.assertFalse(sourceEntry.isDirectory);
            sourceEntry.moveTo(
                test_util.fileSystem.root,
                TESTING_NEW_FILE_NAME,
                function(targetEntry) {
                  chrome.test.fail('Succeeded, but should fail.');
                }, chrome.test.callbackPass(function(error) {
                  chrome.test.assertEq('InvalidModificationError', error.name);
                }));
          }), 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 moveEntrySuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_FILE.name, {create: false},
          chrome.test.callbackPass(function(sourceEntry) {
            chrome.test.assertEq(TESTING_FILE.name, sourceEntry.name);
            chrome.test.assertFalse(sourceEntry.isDirectory);
            sourceEntry.moveTo(
                test_util.fileSystem.root,
                TESTING_NEW_FILE_NAME,
                chrome.test.callbackPass(function(targetEntry) {
                  chrome.test.assertEq(TESTING_NEW_FILE_NAME, targetEntry.name);
                  chrome.test.assertFalse(targetEntry.isDirectory);
                  test_util.fileSystem.root.getFile(
                      TESTING_FILE.name, {create: false},
                      function(newSourceEntry) {
                        chrome.test.fail('Source file not deleted.');
                      },
                      chrome.test.callbackPass(function(error) {
                        chrome.test.assertEq('NotFoundError', error.name);
                      }))
                }), function(error) {
                  chrome.test.fail(error.name);
                });
          }), function(error) {
            chrome.test.fail(error.name);
          });
    },
    function moveEntryExistsError() {
      test_util.fileSystem.root.getFile(
          TESTING_ANOTHER_FILE.name, {create: false},
          chrome.test.callbackPass(function(sourceEntry) {
            chrome.test.assertEq(TESTING_ANOTHER_FILE.name, sourceEntry.name);
            chrome.test.assertFalse(sourceEntry.isDirectory);
            sourceEntry.moveTo(
                test_util.fileSystem.root,
                TESTING_NEW_FILE_NAME,
                function(targetEntry) {
                  chrome.test.fail('Succeeded, but should fail.');
                }, chrome.test.callbackPass(function(error) {
                  chrome.test.assertEq('InvalidModificationError', error.name);
                }));
          }), function(error) {
            chrome.test.fail(error.name);
          });
    }
  ]);
}
function runTests ( ) { chrome . test . runTests ( [ function moveEntrySuccess ( ) { test_util . fileSystem . root . getFile ( TESTING_FILE . name , { create : false } , chrome . test . callbackPass ( function ( sourceEntry ) { chrome . test . assertEq ( TESTING_FILE . name , sourceEntry . name ) ; chrome . test . assertFalse ( sourceEntry . isDirectory ) ; sourceEntry . moveTo ( test_util . fileSystem . root , TESTING_NEW_FILE_NAME , chrome . test . callbackPass ( function ( targetEntry ) { chrome . test . assertEq ( TESTING_NEW_FILE_NAME , targetEntry . name ) ; chrome . test . assertFalse ( targetEntry . isDirectory ) ; test_util . fileSystem . root . getFile ( TESTING_FILE . name , { create : false } , function ( newSourceEntry ) { chrome . test . fail ( 'Source file not deleted.' ) ; } , chrome . test . callbackPass ( function ( error ) { chrome . test . assertEq ( 'NotFoundError' , error . name ) ; } ) ) } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } , function moveEntryExistsError ( ) { test_util . fileSystem . root . getFile ( TESTING_ANOTHER_FILE . name , { create : false } , chrome . test . callbackPass ( function ( sourceEntry ) { chrome . test . assertEq ( TESTING_ANOTHER_FILE . name , sourceEntry . name ) ; chrome . test . assertFalse ( sourceEntry . isDirectory ) ; sourceEntry . moveTo ( test_util . fileSystem . root , TESTING_NEW_FILE_NAME , function ( targetEntry ) { chrome . test . fail ( 'Succeeded, but should fail.' ) ; } , chrome . test . callbackPass ( function ( error ) { chrome . test . assertEq ( 'InvalidModificationError' , error . name ) ; } ) ) ; } ) , 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 .
// Move an existing file to a non-existing destination. Should succeed. // The source file should be deleted. // Move an existing file to a location which already holds a file. // Should fail.