Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: chrome/test/data/extensions/api_test/file_system/open_existing/test.js

Issue 10663014: Add tests for chrome.fileSystem app API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698