4 <script src=
"resources/fs-test-util.js"></script>
5 <script src=
"../../resources/js-test.js"></script>
8 <p id=
"description"></p>
9 <div id=
"console"></div>
11 description("Test readonly attributes of File.");
13 var fileSystem
= null;
14 var testFileName
= '/testFileEntry.txt';
15 var testFileEntry
= null;
18 function setReadonlyProperty(property
, value
)
20 oldValue
= eval(property
);
21 debug("trying to set readonly property " + property
);
22 evalAndLog(property
+ " = " + value
);
23 newValue
= eval(property
);
24 if (oldValue
== newValue
) {
25 testPassed(property
+ " is still " + oldValue
);
27 testFailed(property
+ " value was changed");
31 function errorCallback(error
) {
32 testFailed("Error occured:" + error
.name
);
36 function fileCallback(file
) {
38 setReadonlyProperty("testFile.size", "1");
39 setReadonlyProperty("testFile.type", "'application/octet-stream'");
40 setReadonlyProperty("testFile.name", "'bar'");
44 function getFileFromEntry(entry
) {
45 testFileEntry
= entry
;
46 evalAndLog("testFileEntry.file(fileCallback, errorCallback);");
49 function createTestFile() {
50 evalAndLog("fileSystem.root.getFile(testFileName, {create:true}, getFileFromEntry, errorCallback);");
53 function fileSystemCallback(fs
) {
55 evalAndLog("removeAllInDirectory(fileSystem.root, createTestFile, errorCallback);");
58 var jsTestIsAsync
= true;
59 evalAndLog("webkitRequestFileSystem(TEMPORARY, 100, fileSystemCallback, errorCallback);");