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); |
- })); |
-} |