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

Unified Diff: chrome/test/data/extensions/api_test/file_system/get_entry_id/test_util.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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/file_system/get_entry_id/test_util.js
diff --git a/chrome/test/data/extensions/api_test/file_system/get_entry_id/test_util.js b/chrome/test/data/extensions/api_test/file_system/get_entry_id/test_util.js
deleted file mode 100644
index c4845b2f867e52a9a4c9e8805530495283853406..0000000000000000000000000000000000000000
--- a/chrome/test/data/extensions/api_test/file_system/get_entry_id/test_util.js
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// 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
-// chrome/test/data/extensions/api_test/file_system
-
-function checkEntry(entry, expectedName, isNew, shouldBeWritable) {
- chrome.test.assertEq(expectedName, entry.name);
- // Test that the file can be read.
- entry.file(chrome.test.callback(function(file) {
- var reader = new FileReader();
- reader.onloadend = chrome.test.callbackPass(function(e) {
- if (isNew)
- chrome.test.assertEq(reader.result, "");
- else
- chrome.test.assertEq(reader.result.indexOf("Can you see me?"), 0);
- // Test that we can write to the file, or not, depending on
- // |shouldBeWritable|.
- entry.createWriter(function(fileWriter) {
- fileWriter.onwriteend = chrome.test.callback(function(e) {
- if (fileWriter.error) {
- if (shouldBeWritable) {
- chrome.test.fail("Error writing to file: " +
- fileWriter.error.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);
- }));
- }));
- } else {
- chrome.test.fail(
- "'Could write to file that should not be writable.");
- }
- }
- });
- var blob = new Blob(["HoHoHo!"], {type: "text/plain"});
- fileWriter.write(blob);
- });
- });
- reader.onerror = chrome.test.callback(function(e) {
- chrome.test.fail("Error reading file contents.");
- });
- reader.readAsText(file);
- }));
-}

Powered by Google App Engine
This is Rietveld 408576698