blob: 1a8dd7bba694bc5b4b3aa9eeaa53154cba08e213 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="resources/fs-test-util.js"></script>
<script src="../../resources/js-test.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 occurred:" + error.name);
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);");
</script>
</body>
</html>