function truncateFileSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_TIRAMISU_FILE_NAME,
          {create: false, exclusive: true},
          chrome.test.callbackPass(function(fileEntry) {
            fileEntry.createWriter(
                chrome.test.callbackPass(function(fileWriter) {
                  fileWriter.onwriteend = chrome.test.callbackPass(function(e) {
                    // Note that onwriteend() is called even if an error
                    // happened.
                    if (fileWriter.error)
                      return;
                    chrome.test.assertEq(
                        64,
                        test_util.defaultMetadata[
                            '/' + TESTING_TIRAMISU_FILE_NAME].size);
                  });
                  fileWriter.onerror = function(e) {
                    chrome.test.fail(fileWriter.error.name);
                  };
                  fileWriter.truncate(64);
                }),
                function(error) {
                  chrome.test.fail(error.name);
                });
          }),
          function(error) {
            chrome.test.fail(error.name);
          });
    }
// Truncate a file. It should succeed.
Truncate a file. It should succeed.
Truncate a file . It should succeed .
function truncateFileSuccess() {
      test_util.fileSystem.root.getFile(
          TESTING_TIRAMISU_FILE_NAME,
          {create: false, exclusive: true},
          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(
                        64,
                        test_util.defaultMetadata[
                            '/' + TESTING_TIRAMISU_FILE_NAME].size);
                  });
                  fileWriter.onerror = function(e) {
                    chrome.test.fail(fileWriter.error.name);
                  };
                  fileWriter.truncate(64);
                }),
                function(error) {
                  chrome.test.fail(error.name);
                });
          }),
          function(error) {
            chrome.test.fail(error.name);
          });
    }
function truncateFileSuccess ( ) { test_util . fileSystem . root . getFile ( TESTING_TIRAMISU_FILE_NAME , { create : false , exclusive : true } , 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 ( 64 , test_util . defaultMetadata [ '/' + TESTING_TIRAMISU_FILE_NAME ] . size ) ; } ) ; fileWriter . onerror = function ( e ) { chrome . test . fail ( fileWriter . error . name ) ; } ; fileWriter . truncate ( 64 ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; }
Truncate a file.
Truncate a file .
// Note that onwriteend() is called even if an error // happened.