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

Unified Diff: chrome/test/data/extensions/api_test/file_system/open_directory_with_write/test_util.js

Issue 23146016: Add support for directory access to the file system API. (Closed) Base URL: http://git.chromium.org/chromium/src.git@simpler-write-permissions
Patch Set: Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
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 65%
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..f0b37f739b8e8986fe3047d2e8669299befa7316 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,9 +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
+// TODO(sammc): Merge the changes back to the original test_util.js. See
+// http://crbug.com/280942.
function checkEntry(entry, expectedName, isNew, shouldBeWritable) {
chrome.test.assertEq(expectedName, entry.name);
@@ -36,19 +38,23 @@ function checkEntry(entry, expectedName, isNew, shouldBeWritable) {
} 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 {

Powered by Google App Engine
This is Rietveld 408576698