blob: ca501fffeb44ce7b080b52abd9b079b967ee744f [file] [log] [blame]
if (this.importScripts) {
importScripts('fs-worker-common.js');
importScripts('../../../resources/js-test.js');
importScripts('fs-test-util.js');
}
description("Obtaining File from FileEntry.");
var fileSystem = null;
var testFileName = '/testFileEntry.txt';
var testFileEntry = null;
var testFile = null;
function errorCallback(error) {
testFailed("Error occurred:" + error.name);
finishJSTest();
}
function fileCallback(file) {
testFile = file;
shouldBe("testFile.name", "testFileEntry.name");
shouldBe("testFile.type", "'text/plain'");
shouldBe("testFile.size", "0");
finishJSTest();
}
function getFileFromEntry(entry) {
testFileEntry = entry;
entry.file(fileCallback, errorCallback);
}
function createTestFile() {
fileSystem.root.getFile(testFileName, {create:true}, getFileFromEntry, errorCallback);
}
function fileSystemCallback(fs) {
fileSystem = fs;
removeAllInDirectory(fileSystem.root, createTestFile, errorCallback);
}
var jsTestIsAsync = true;
webkitRequestFileSystem(TEMPORARY, 100, fileSystemCallback, errorCallback);