function writeBrokenFileError() {
      var onTestSuccess = chrome.test.callbackPass();
      test_util.fileSystem.root.getFile(
          TESTING_BROKEN_TIRAMISU_FILE_NAME,
          {create: false, exclusive: false},
          function(fileEntry) {
            fileEntry.createWriter(function(fileWriter) {
              fileWriter.onwriteend = function(e) {
                if (fileWriter.error)
                  return;
                chrome.test.fail(
                    'Unexpectedly succeeded to write to a broken file.');
              };
              fileWriter.onerror = function(e) {
                chrome.test.assertEq(
                    'InvalidStateError', fileWriter.error.name);
                onTestSuccess();
              };
              var blob = new Blob(['A lot of flowers.'], {type: 'text/plain'});
              fileWriter.write(blob);
            },
            function(error) {
              chrome.test.fail();
            });
          },
          function(error) {
            chrome.test.fail(error.name);
          });
    }
// Write bytes to a broken file. This should result in an error.
Write bytes to a broken file. This should result in an error.
Write bytes to a broken file . This should result in an error .
function writeBrokenFileError() {
      var onTestSuccess = chrome.test.callbackPass();
      test_util.fileSystem.root.getFile(
          TESTING_BROKEN_TIRAMISU_FILE_NAME,
          {create: false, exclusive: false},
          function(fileEntry) {
            fileEntry.createWriter(function(fileWriter) {
              fileWriter.onwriteend = function(e) {
                if (fileWriter.error)
                  return;
                chrome.test.fail(
                    'Unexpectedly succeeded to write to a broken file.');
              };
              fileWriter.onerror = function(e) {
                chrome.test.assertEq(
                    'InvalidStateError', fileWriter.error.name);
                onTestSuccess();
              };
              var blob = new Blob(['A lot of flowers.'], {type: 'text/plain'});
              fileWriter.write(blob);
            },
            function(error) {
              chrome.test.fail();
            });
          },
          function(error) {
            chrome.test.fail(error.name);
          });
    }
function writeBrokenFileError ( ) { var onTestSuccess = chrome . test . callbackPass ( ) ; test_util . fileSystem . root . getFile ( TESTING_BROKEN_TIRAMISU_FILE_NAME , { create : false , exclusive : false } , function ( fileEntry ) { fileEntry . createWriter ( function ( fileWriter ) { fileWriter . onwriteend = function ( e ) { if ( fileWriter . error ) return ; chrome . test . fail ( 'Unexpectedly succeeded to write to a broken file.' ) ; } ; fileWriter . onerror = function ( e ) { chrome . test . assertEq ( 'InvalidStateError' , fileWriter . error . name ) ; onTestSuccess ( ) ; } ; var blob = new Blob ( [ 'A lot of flowers.' ] , { type : 'text/plain' } ) ; fileWriter . write ( blob ) ; } , function ( error ) { chrome . test . fail ( ) ; } ) ; } , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; }
Write bytes to a broken file.
Write bytes to a broken file .