Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 chrome.test.runTests([ | |
| 2 function openFile() { | |
| 3 chrome.fileSystem.chooseFile(chrome.test.callbackPass(function(entry) { | |
| 4 chrome.test.assertEq('open_existing.txt', entry.name); | |
| 5 // Test that the file can be read. | |
| 6 entry.file(chrome.test.callback(function(file) { | |
| 7 var reader = new FileReader(); | |
| 8 reader.onloadend = chrome.test.callback(function(e) { | |
| 9 chrome.test.assertEq(reader.result.indexOf("Can you see me?"), 0); | |
| 10 // Test that we cannot write to the file. | |
| 11 entry.createWriter(chrome.test.callback(function(fileWriter) { | |
| 12 fileWriter.onwriteend = chrome.test.callback(function(e) { | |
| 13 if (fileWriter.error) | |
| 14 chrome.test.succeed(); | |
| 15 else | |
| 16 chrome.test.fail("No error while writing without write access"); | |
| 17 }); | |
| 18 var bb = new WebKitBlobBuilder(); | |
| 19 bb.append('HoHoHo!'); | |
| 20 fileWriter.write(bb.getBlob('text/plain')); | |
|
kinuko
2012/06/24 09:55:57
Please use new Blob constructor instead:
new Blob
benwells
2012/06/25 19:07:21
Done.
| |
| 21 })); | |
| 22 }); | |
| 23 reader.onerror = chrome.test.callback(function(e) { | |
| 24 chrome.test.fail("Error reading file contents."); | |
| 25 }); | |
| 26 reader.readAsText(file); | |
| 27 })); | |
| 28 })); | |
| 29 } | |
| 30 ]); | |
| OLD | NEW |