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

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: Using new Blob constructor Created 8 years, 5 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 blob = new Blob(['HoHoHo!'], {type: 'text/plain'});
19 fileWriter.write(blob);
20 }));
21 });
22 reader.onerror = chrome.test.callback(function(e) {
23 chrome.test.fail("Error reading file contents.");
24 });
25 reader.readAsText(file);
26 }));
27 }));
28 }
29 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698