function abortOpenedAndReopenSuccess() {
      setUpFileSystem(1 /* no limit */, chrome.test.callbackPass(function() {
        test_util.fileSystem.root.getFile(
            TESTING_VANILLA_FOR_ABORT_FILE.name,
            {create: false, exclusive: false},
            chrome.test.callbackPass(function(fileEntry) {
              fileEntry.file(chrome.test.callbackPass(function(file) {
                var fileReader = new FileReader();
                var fileReader2 = new FileReader();
                fileReader.onabort = chrome.test.callbackPass(function(e) {
                  chrome.test.assertEq(
                      'AbortError', fileReader.error.name);
                  // Confirm that the file is closed on the provider side.
                  chrome.test.assertEq(
                      0, Object.keys(test_util.openedFiles).length);
                });
                // Set a breakpoint on reading a file, so aborting is invoked
                // after it's started.
                openBreakpointCallback = chrome.test.callbackPass(
                    function(filePath, continueCallback) {
                      fileReader.abort();
                      setTimeout(chrome.test.callbackPass(function() {
                        continueCallback();
                        chrome.test.assertEq(
                            1, Object.keys(test_util.openedFiles).length);
                      }), 0);
                      openBreakpointCallback = chrome.test.callbackPass(
                          function() {
                            // The next OpenFile request should happen only
                            // after the previous file is closed successfully
                            // due to abort.
                            chrome.test.assertEq(
                                0, Object.keys(test_util.openedFiles).length);
                          });
                    });
                fileReader.readAsText(file);
                // The second reader should enqueue until the first file is
                // closed.
                fileReader2.readAsText(file);
              }),
              function(error) {
                chrome.test.fail(error.name);
              });
            }),
            function(error) {
              chrome.test.fail(error.name);
            });
      }));
    }
// opened files at once. This is a regression test for: crbug.com/519063.
opened files at once. This is a regression test for: crbug.com/519063.
opened files at once . This is a regression test for : crbug . com / 519063 .
function abortOpenedAndReopenSuccess() {
      setUpFileSystem(1 , chrome.test.callbackPass(function() {
        test_util.fileSystem.root.getFile(
            TESTING_VANILLA_FOR_ABORT_FILE.name,
            {create: false, exclusive: false},
            chrome.test.callbackPass(function(fileEntry) {
              fileEntry.file(chrome.test.callbackPass(function(file) {
                var fileReader = new FileReader();
                var fileReader2 = new FileReader();
                fileReader.onabort = chrome.test.callbackPass(function(e) {
                  chrome.test.assertEq(
                      'AbortError', fileReader.error.name);
                  chrome.test.assertEq(
                      0, Object.keys(test_util.openedFiles).length);
                });
                openBreakpointCallback = chrome.test.callbackPass(
                    function(filePath, continueCallback) {
                      fileReader.abort();
                      setTimeout(chrome.test.callbackPass(function() {
                        continueCallback();
                        chrome.test.assertEq(
                            1, Object.keys(test_util.openedFiles).length);
                      }), 0);
                      openBreakpointCallback = chrome.test.callbackPass(
                          function() {
                            chrome.test.assertEq(
                                0, Object.keys(test_util.openedFiles).length);
                          });
                    });
                fileReader.readAsText(file);
                fileReader2.readAsText(file);
              }),
              function(error) {
                chrome.test.fail(error.name);
              });
            }),
            function(error) {
              chrome.test.fail(error.name);
            });
      }));
    }
function abortOpenedAndReopenSuccess ( ) { setUpFileSystem ( 1 , chrome . test . callbackPass ( function ( ) { test_util . fileSystem . root . getFile ( TESTING_VANILLA_FOR_ABORT_FILE . name , { create : false , exclusive : false } , chrome . test . callbackPass ( function ( fileEntry ) { fileEntry . file ( chrome . test . callbackPass ( function ( file ) { var fileReader = new FileReader ( ) ; var fileReader2 = new FileReader ( ) ; fileReader . onabort = chrome . test . callbackPass ( function ( e ) { chrome . test . assertEq ( 'AbortError' , fileReader . error . name ) ; chrome . test . assertEq ( 0 , Object . keys ( test_util . openedFiles ) . length ) ; } ) ; openBreakpointCallback = chrome . test . callbackPass ( function ( filePath , continueCallback ) { fileReader . abort ( ) ; setTimeout ( chrome . test . callbackPass ( function ( ) { continueCallback ( ) ; chrome . test . assertEq ( 1 , Object . keys ( test_util . openedFiles ) . length ) ; } ) , 0 ) ; openBreakpointCallback = chrome . test . callbackPass ( function ( ) { chrome . test . assertEq ( 0 , Object . keys ( test_util . openedFiles ) . length ) ; } ) ; } ) ; fileReader . readAsText ( file ) ; fileReader2 . readAsText ( file ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } ) , function ( error ) { chrome . test . fail ( error . name ) ; } ) ; } ) ) ; }
opened files at once.
opened files at once .
/* no limit */ // Confirm that the file is closed on the provider side. // Set a breakpoint on reading a file, so aborting is invoked // after it's started. // The next OpenFile request should happen only // after the previous file is closed successfully // due to abort. // The second reader should enqueue until the first file is // closed.