Index: chrome/test/data/extensions/platform_apps/file_access_restored_test/test.js |
diff --git a/chrome/test/data/extensions/platform_apps/file_access_restored_test/test.js b/chrome/test/data/extensions/platform_apps/file_access_restored_test/test.js |
index 07ebb0b4ca415d1ab22cda6790ed6a88d7403d0c..32a744a8350509e8d6dd79562e5d0d065613f2d8 100644 |
--- a/chrome/test/data/extensions/platform_apps/file_access_restored_test/test.js |
+++ b/chrome/test/data/extensions/platform_apps/file_access_restored_test/test.js |
@@ -26,7 +26,7 @@ chrome.app.runtime.onLaunched.addListener(function() { |
var fs = win.contentWindow.chrome.fileSystem; |
fs.chooseEntry({type: 'openFile'}, function(entry) { |
fs.getWritableEntry(entry, function(writableEntry) { |
- var id = fs.getEntryId(entry); |
+ var id = fs.retainEntry(entry); |
chrome.storage.local.set({id:id}, function() { |
truncateAndWriteToFile(writableEntry, function() { |
chrome.test.sendMessage('fileWritten'); |
@@ -40,35 +40,36 @@ chrome.app.runtime.onLaunched.addListener(function() { |
chrome.app.runtime.onRestarted.addListener(function() { |
chrome.storage.local.get(null, function(data) { |
- var entry = chrome.fileSystem.getEntryById(data.id); |
- if (!entry) { |
- console.error("couldn't get file entry " + data.id); |
- return; |
- } |
- entry.file(function(file) { |
- var fr = new FileReader(); |
- fr.onload = function(e) { |
- if (e.target.result != expectedText) { |
- console.error( |
- "expected '" + expectedText + "', got '" + e.target.result + "'"); |
- return; |
- } |
- entry.createWriter(function(fileWriter) { |
- fileWriter.onwriteend = function(e) { |
- chrome.test.sendMessage('restartedFileAccessOK'); |
- win.close(); |
- }; |
- fileWriter.onerror = function(e) { |
- console.error('Write failed: ' + e.toString()); |
- }; |
- var blob = new Blob(["doesn't matter"], {type: 'text/plain'}); |
- fileWriter.write(blob); |
- }); |
- }; |
- fr.onerror = function(e) { |
- chrome.test.fail("error reading file"); |
- }; |
- fr.readAsText(file); |
+ chrome.fileSystem.restoreEntry(data.id, function(entry) { |
+ if (!entry) { |
+ console.error("couldn't get file entry " + data.id); |
+ return; |
+ } |
+ entry.file(function(file) { |
+ var fr = new FileReader(); |
+ fr.onload = function(e) { |
+ if (e.target.result != expectedText) { |
+ console.error("expected '" + expectedText + "', got '" + |
+ e.target.result + "'"); |
+ return; |
+ } |
+ entry.createWriter(function(fileWriter) { |
+ fileWriter.onwriteend = function(e) { |
+ chrome.test.sendMessage('restartedFileAccessOK'); |
+ win.close(); |
+ }; |
+ fileWriter.onerror = function(e) { |
+ console.error('Write failed: ' + e.toString()); |
+ }; |
+ var blob = new Blob(["doesn't matter"], {type: 'text/plain'}); |
+ fileWriter.write(blob); |
+ }); |
+ }; |
+ fr.onerror = function(e) { |
+ chrome.test.fail("error reading file"); |
+ }; |
+ fr.readAsText(file); |
+ }); |
}); |
}); |
}); |