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

Side by Side Diff: chrome/test/data/extensions/platform_apps/launch_file/test.js

Issue 14607023: Add support for persistent file access in apps. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 chrome.app.runtime.onLaunched.addListener(function (launchData) { 5 chrome.app.runtime.onLaunched.addListener(function (launchData) {
6 // Test that the id and items fields in FileEntry can be read. 6 // Test that the id and items fields in FileEntry can be read.
7 chrome.test.runTests([ 7 chrome.test.runTests([
8 function testFileHandler() { 8 function testFileHandler() {
9 chrome.test.assertFalse(!launchData, "No launchData"); 9 chrome.test.assertFalse(!launchData, "No launchData");
10 chrome.test.assertEq(launchData.id, "text", 10 chrome.test.assertEq(launchData.id, "text",
11 "launchData.id incorrect"); 11 "launchData.id incorrect");
12 chrome.test.assertEq(launchData.items.length, 1); 12 chrome.test.assertEq(launchData.items.length, 1);
13 chrome.test.assertTrue( 13 chrome.test.assertTrue(
14 chrome.fileSystem.getEntryId(launchData.items[0].entry) != null); 14 chrome.fileSystem.retainEntry(launchData.items[0].entry) != null);
15 15
16 launchData.items[0].entry.file(function(file) { 16 launchData.items[0].entry.file(function(file) {
17 var reader = new FileReader(); 17 var reader = new FileReader();
18 reader.onloadend = function(e) { 18 reader.onloadend = function(e) {
19 chrome.test.assertEq( 19 chrome.test.assertEq(
20 reader.result.indexOf("This is a test. Word."), 0); 20 reader.result.indexOf("This is a test. Word."), 0);
21 chrome.test.succeed(); 21 chrome.test.succeed();
22 }; 22 };
23 reader.onerror = function(e) { 23 reader.onerror = function(e) {
24 chrome.test.fail("Error reading file contents."); 24 chrome.test.fail("Error reading file contents.");
25 }; 25 };
26 reader.readAsText(file); 26 reader.readAsText(file);
27 }); 27 });
28 } 28 }
29 ]); 29 ]);
30 }); 30 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698