blob: c0c79bae90d6870bb2c1f42d39d4f4f1c4d9f0f1 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="resources/fs-test-util.js"></script>
<script src="../js/resources/js-test-pre.js"></script>
</head>
<body>
<p id="description"></p>
<div id="console"></div>
<script>
description("Test readonly attributes of File.");
var fileSystem = null;
var testFileName = '/testFileEntry.txt';
var testFileEntry = null;
var testFile = null;
function setReadonlyProperty(property, value)
{
oldValue = eval(property);
debug("trying to set readonly property " + property);
evalAndLog(property + " = " + value);
newValue = eval(property);
if (oldValue == newValue) {
testPassed(property + " is still " + oldValue);
} else {
testFailed(property + " value was changed");
}
}
function errorCallback(error) {
testFailed("Error occured:" + error.code);
finishJSTest();
}
function fileCallback(file) {
testFile = file;
setReadonlyProperty("testFile.size", "1");
setReadonlyProperty("testFile.type", "'application/octet-stream'");
setReadonlyProperty("testFile.name", "'bar'");
finishJSTest();
}
function getFileFromEntry(entry) {
testFileEntry = entry;
evalAndLog("testFileEntry.file(fileCallback, errorCallback);");
}
function createTestFile() {
evalAndLog("fileSystem.root.getFile(testFileName, {create:true}, getFileFromEntry, errorCallback);");
}
function fileSystemCallback(fs) {
fileSystem = fs;
evalAndLog("removeAllInDirectory(fileSystem.root, createTestFile, errorCallback);");
}
var jsTestIsAsync = true;
evalAndLog("webkitRequestFileSystem(TEMPORARY, 100, fileSystemCallback, errorCallback);");
var successfullyParsed = true;
</script>
<script src="../js/resources/js-test-post.js"></script>
</body>
</html>