function overwriteFileSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_TIRAMISU_FILE_NAME,
          {create: true, exclusive: false},
          chrome.test.callbackPass(function(fileEntry) {
            fileEntry.createWriter(
                chrome.test.callbackPass(function(fileWriter) {
                fileWriter.onwriteend = chrome.test.callbackPass(function(e) {
                  if (fileWriter.error)
                    return;
                  chrome.test.assertEq(
                      TESTING_TEXT_TO_WRITE,
                      fileContents['/' + TESTING_TIRAMISU_FILE_NAME]);
                });
                fileWriter.onerror = function(e) {
                  chrome.test.fail(fileWriter.error.name);
                };
                var blob = new Blob(
                    [TESTING_TEXT_TO_WRITE], {type: 'text/plain'});
                fileWriter.write(blob);
              }),
              function(error) {
                chrome.test.fail(error.name);
              });
          }),
          function(error) {
            chrome.test.fail(error.name);
          });
    }
// Overwrite contents in an existing file. It should succeed.
Overwrite contents in an existing file. It should succeed.
Overwrite contents in an existing file . It should succeed .
function overwriteFileSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_TIRAMISU_FILE_NAME,
          {create: true, exclusive: false},
          chrome.test.callbackPass(function(fileEntry) {
            fileEntry.createWriter(
                chrome.test.callbackPass(function(fileWriter) {
                fileWriter.onwriteend = chrome.test.callbackPass(function(e) {
                  if (fileWriter.error)
                    return;
                  chrome.test.assertEq(
                      TESTING_TEXT_TO_WRITE,
                      fileContents['/' + TESTING_TIRAMISU_FILE_NAME]);
                });
                fileWriter.onerror = function(e) {
                  chrome.test.fail(fileWriter.error.name);
                };
                var blob = new Blob(
                    [TESTING_TEXT_TO_WRITE], {type: 'text/plain'});
                fileWriter.write(blob);
              }),
              function(error) {
                chrome.test.fail(error.name);
              });
          }),
          function(error) {
            chrome.test.fail(error.name);
          });
    }
function overwriteFileSuccess ( ) { test_util . fileSystem . root . getFile ( TESTING_TIRAMISU_FILE_NAME , { create : true , exclusive : false } , chrome . test . callbackPass ( function ( fileEntry ) { fileEntry . createWriter ( chrome . test . callbackPass ( function ( fileWriter ) { fileWriter . onwriteend = chrome . test . callbackPass ( function ( e ) { if ( fileWriter . error ) return ; chrome . test . assertEq ( TESTING_TEXT_TO_WRITE , fileContents [ '/' + TESTING_TIRAMISU_FILE_NAME ] ) ; } ) ; fileWriter . onerror = function ( e ) { chrome . test . fail ( fileWriter . error . name ) ; } ; var blob = new Blob ( [ TESTING_TEXT_TO_WRITE ] , { type : 'text/plain' } ) ; fileWriter . write ( blob ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; }
Overwrite contents in an existing file.
Overwrite contents in an existing file .