Title: [97545] trunk/LayoutTests
Revision
97545
Author
[email protected]
Date
2011-10-15 00:08:39 -0700 (Sat, 15 Oct 2011)

Log Message

[FileSystem API] File readonly attributes test
https://bugs.webkit.org/show_bug.cgi?id=69687

Patch by Mark Pilgrim <[email protected]> on 2011-10-15
Reviewed by Adam Barth.

* fast/filesystem/simple-readonly-file-object-expected.txt: Added.
* fast/filesystem/simple-readonly-file-object.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (97544 => 97545)


--- trunk/LayoutTests/ChangeLog	2011-10-15 07:03:43 UTC (rev 97544)
+++ trunk/LayoutTests/ChangeLog	2011-10-15 07:08:39 UTC (rev 97545)
@@ -1,5 +1,15 @@
 2011-10-15  Mark Pilgrim  <[email protected]>
 
+        [FileSystem API] File readonly attributes test
+        https://bugs.webkit.org/show_bug.cgi?id=69687
+
+        Reviewed by Adam Barth.
+
+        * fast/filesystem/simple-readonly-file-object-expected.txt: Added.
+        * fast/filesystem/simple-readonly-file-object.html: Added.
+
+2011-10-15  Mark Pilgrim  <[email protected]>
+
         [File API] URL methods required arguments
         https://bugs.webkit.org/show_bug.cgi?id=69692
 

Added: trunk/LayoutTests/fast/filesystem/simple-readonly-file-object-expected.txt (0 => 97545)


--- trunk/LayoutTests/fast/filesystem/simple-readonly-file-object-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/simple-readonly-file-object-expected.txt	2011-10-15 07:08:39 UTC (rev 97545)
@@ -0,0 +1,22 @@
+Test readonly attributes of File.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+webkitRequestFileSystem(TEMPORARY, 100, fileSystemCallback, errorCallback);
+removeAllInDirectory(fileSystem.root, createTestFile, errorCallback);
+fileSystem.root.getFile(testFileName, {create:true}, getFileFromEntry, errorCallback);
+testFileEntry.file(fileCallback, errorCallback);
+trying to set readonly property testFile.size
+testFile.size = 1
+PASS testFile.size is still 0
+trying to set readonly property testFile.type
+testFile.type = 'application/octet-stream'
+PASS testFile.type is still text/plain
+trying to set readonly property testFile.name
+testFile.name = 'bar'
+PASS testFile.name is still testFileEntry.txt
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/filesystem/simple-readonly-file-object.html (0 => 97545)


--- trunk/LayoutTests/fast/filesystem/simple-readonly-file-object.html	                        (rev 0)
+++ trunk/LayoutTests/fast/filesystem/simple-readonly-file-object.html	2011-10-15 07:08:39 UTC (rev 97545)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+<script src=""
+</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=""
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to