| Index: chrome/test/data/extensions/api_test/file_system/open_directory_with_write/test.js
|
| diff --git a/chrome/test/data/extensions/api_test/file_system/open_directory_with_write/test.js b/chrome/test/data/extensions/api_test/file_system/open_directory_with_write/test.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5549b1a30ad0d3ac2d0ba2832364764b40d01711
|
| --- /dev/null
|
| +++ b/chrome/test/data/extensions/api_test/file_system/open_directory_with_write/test.js
|
| @@ -0,0 +1,98 @@
|
| +// Copyright 2013 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.
|
| +
|
| +chrome.test.runTests([
|
| + function moveFile() {
|
| + chrome.fileSystem.chooseEntry(
|
| + {type: 'openDirectory'},
|
| + chrome.test.callbackPass(function(directoryEntry) {
|
| + directoryEntry.getFile(
|
| + 'open_existing.txt', {}, chrome.test.callback(function(entry) {
|
| + entry.copyTo(
|
| + directoryEntry, 'to_move.txt', chrome.test.callback(function(copy) {
|
| + copy.moveTo(
|
| + directoryEntry, 'moved.txt', chrome.test.callback(function(move) {
|
| + directoryEntry.getFile(
|
| + 'to_move.txt', {}, chrome.test.callback(function(entry) {
|
| + chrome.test.fail('Could open move source');
|
| + }), chrome.test.callback(function() {
|
| + checkEntry(move, 'moved.txt', false, true);
|
| + }));
|
| + }), chrome.test.callback(function() {
|
| + chrome.test.fail('Failed to move file');
|
| + }));
|
| + }), chrome.test.callback(function() {
|
| + chrome.test.fail('Failed to copy file');
|
| + }));
|
| + }), chrome.test.callback(function() {
|
| + chrome.test.fail('Failed to open file');
|
| + }));
|
| + }))
|
| + },
|
| + function copyFile() {
|
| + chrome.fileSystem.chooseEntry(
|
| + {type: 'openDirectory'},
|
| + chrome.test.callbackPass(function(directoryEntry) {
|
| + directoryEntry.getFile(
|
| + 'open_existing.txt', {}, chrome.test.callback(function(entry) {
|
| + entry.copyTo(
|
| + directoryEntry, 'copy.txt', chrome.test.callback(function(copy) {
|
| + checkEntry(copy, 'copy.txt', false, true);
|
| + }), chrome.test.callback(function() {
|
| + chrome.test.fail('Failed to copy file');
|
| + }));
|
| + }), chrome.test.callback(function() {
|
| + chrome.test.fail('Failed to open file');
|
| + }));
|
| + }));
|
| + },
|
| + function createFile() {
|
| + chrome.fileSystem.chooseEntry(
|
| + {type: 'openDirectory'},
|
| + chrome.test.callbackPass(function(directoryEntry) {
|
| + directoryEntry.getFile(
|
| + 'new.txt', {create: true}, chrome.test.callback(function(entry) {
|
| + checkEntry(entry, 'new.txt', true, true);
|
| + }), chrome.test.callback(function(err) {
|
| + chrome.test.fail('Failed to create file');
|
| + }));
|
| + }));
|
| + },
|
| + function createDirectory() {
|
| + chrome.fileSystem.chooseEntry(
|
| + {type: 'openDirectory'},
|
| + chrome.test.callbackPass(function(directoryEntry) {
|
| + directoryEntry.getDirectory(
|
| + 'new', {create: true}, chrome.test.callback(function(entry) {
|
| + chrome.test.assertEq(entry.name, 'new');
|
| + chrome.test.succeed();
|
| + }), chrome.test.callback(function(err) {
|
| + chrome.test.fail('Failed to create directory');
|
| + }));
|
| + }));
|
| + },
|
| + function removeFile() {
|
| + chrome.fileSystem.chooseEntry(
|
| + {type: 'openDirectory'},
|
| + chrome.test.callbackPass(function(directoryEntry) {
|
| + directoryEntry.getFile(
|
| + 'remove.txt', {create: true},
|
| + chrome.test.callback(function(entry) {
|
| + entry.remove(chrome.test.callback(function() {
|
| + directoryEntry.getFile(
|
| + 'remove.txt', {},
|
| + chrome.test.callback(function() {
|
| + chrome.test.fail('Could open deleted file');
|
| + }), chrome.test.callback(function() {
|
| + chrome.test.succeed();
|
| + }))
|
| + }), chrome.test.callback(function() {
|
| + chrome.test.fail('Failed to delete file');
|
| + }));
|
| + }), chrome.test.callback(function(err) {
|
| + chrome.test.fail('Failed to create file');
|
| + }));
|
| + }));
|
| + }
|
| +]);
|
|
|