Index: chrome/test/data/extensions/api_test/file_system/open_directory_with_write/test_util.js |
diff --git a/chrome/test/data/extensions/api_test/file_system/test_util.js b/chrome/test/data/extensions/api_test/file_system/open_directory_with_write/test_util.js |
similarity index 59% |
copy from chrome/test/data/extensions/api_test/file_system/test_util.js |
copy to chrome/test/data/extensions/api_test/file_system/open_directory_with_write/test_util.js |
index a768b029fbdfbdd14813c457d1bb741f3f5993ca..97ae4019a6bc8286d798b4e2a9f3b69437111888 100644 |
--- a/chrome/test/data/extensions/api_test/file_system/test_util.js |
+++ b/chrome/test/data/extensions/api_test/file_system/open_directory_with_write/test_util.js |
@@ -2,18 +2,11 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-// This is a duplicate of the file test_util in |
+// This is a modified duplicate of the file test_util in |
// chrome/test/data/extensions/api_test/file_system |
function checkEntry(entry, expectedName, isNew, shouldBeWritable) { |
chrome.test.assertEq(expectedName, entry.name); |
- |
- // Test that we are writable (or not), as expected. |
- chrome.fileSystem.isWritableEntry(entry, chrome.test.callbackPass( |
- function(isWritable) { |
- chrome.test.assertEq(isWritable, shouldBeWritable); |
- })); |
- |
// Test that the file can be read. |
entry.file(chrome.test.callback(function(file) { |
var reader = new FileReader(); |
@@ -28,27 +21,31 @@ function checkEntry(entry, expectedName, isNew, shouldBeWritable) { |
fileWriter.onwriteend = chrome.test.callback(function(e) { |
if (fileWriter.error) { |
if (shouldBeWritable) { |
- chrome.test.fail("Error writing to file: " + |
- fileWriter.error.toString()); |
+ chrome.test.fail("Error writing to file " + expectedName + ": " + |
+ fileWriter.error.code.toString()); |
} else { |
chrome.test.succeed(); |
} |
} else { |
if (shouldBeWritable) { |
// Get a new entry and check the data got to disk. |
- chrome.fileSystem.chooseEntry(chrome.test.callbackPass( |
- function(readEntry) { |
- readEntry.file(chrome.test.callback(function(readFile) { |
- var readReader = new FileReader(); |
- readReader.onloadend = function(e) { |
- chrome.test.assertEq(readReader.result.indexOf("HoHoHo!"), |
- 0); |
- chrome.test.succeed(); |
- }; |
- readReader.onerror = function(e) { |
- chrome.test.fail("Failed to read file after write."); |
- }; |
- readReader.readAsText(readFile); |
+ chrome.fileSystem.chooseEntry( |
+ {type: 'openDirectory'}, chrome.test.callbackPass( |
+ function(directoryEntry) { |
+ directoryEntry.getFile( |
+ entry.name, {}, chrome.test.callback(function(readEntry) { |
+ readEntry.file(chrome.test.callback(function(readFile) { |
+ var readReader = new FileReader(); |
+ readReader.onloadend = function(e) { |
+ chrome.test.assertEq(readReader.result.indexOf("HoHoHo!"), |
+ 0); |
+ chrome.test.succeed(); |
+ }; |
+ readReader.onerror = function(e) { |
+ chrome.test.fail("Failed to read file after write."); |
+ }; |
+ readReader.readAsText(readFile); |
+ })); |
})); |
})); |
} else { |