LayoutTests/ChangeLog

 12010-09-29 Kinuko Yasuda <kinuko@chromium.org>
 2
 3 Reviewed by NOBODY (OOPS!).
 4
 5 Add layout tests for FileSystem API
 6 https://bugs.webkit.org/show_bug.cgi?id=44920
 7
 8 * fast/filesystem/op-copy-expected.txt: Added.
 9 * fast/filesystem/op-copy.html: Added.
 10 * fast/filesystem/op-get-entry-expected.txt: Added.
 11 * fast/filesystem/op-get-entry.html: Added.
 12 * fast/filesystem/op-get-metadata-expected.txt: Added.
 13 * fast/filesystem/op-get-metadata.html: Added.
 14 * fast/filesystem/op-get-parent-expected.txt: Added.
 15 * fast/filesystem/op-get-parent.html: Added.
 16 * fast/filesystem/op-move-expected.txt: Added.
 17 * fast/filesystem/op-move.html: Added.
 18 * fast/filesystem/op-read-directory-expected.txt: Added.
 19 * fast/filesystem/op-read-directory.html: Added.
 20 * fast/filesystem/op-remove-expected.txt: Added.
 21 * fast/filesystem/op-remove.html: Added.
 22 * fast/filesystem/parallel-operations-expected.txt: Added.
 23 * fast/filesystem/parallel-operations.html: Added.
 24 * fast/filesystem/read-directory-expected.txt.orig: Added.
 25 * fast/filesystem/request-fs-twice-persistent-expected.txt: Added.
 26 * fast/filesystem/request-fs-twice-persistent.html: Added.
 27 * fast/filesystem/request-fs-twice-temporary-expected.txt: Added.
 28 * fast/filesystem/request-fs-twice-temporary.html: Added.
 29 * fast/filesystem/resources/fs-test-shell-temporary.js: Added.
 30 * fast/filesystem/resources/fs-test-shell.js: Added.
 31 * fast/filesystem/resources/fs-test-util.js.orig: Added.
 32 * fast/filesystem/restricted-chars-expected.txt: Added.
 33 * fast/filesystem/restricted-chars.html: Added.
 34 * fast/filesystem/restricted-names-expected.txt: Added.
 35 * fast/filesystem/restricted-names.html: Added.
 36 * fast/filesystem/script-tests/parallel-operations.js: Added.
 37 * fast/filesystem/script-tests/read-directory.js.orig: Added.
 38 * fast/filesystem/script-tests/simple-persistent.js: Added.
 39 * fast/filesystem/script-tests/simple-temporary.js: Added.
 40 * fast/filesystem/simple-persistent-expected.txt: Added.
 41 * fast/filesystem/simple-persistent.html: Added.
 42 * fast/filesystem/simple-temporary-expected.txt: Added.
 43 * fast/filesystem/simple-temporary.html: Added.
 44
1452010-09-29 Adam Barth <abarth@webkit.org>
246
347 This test result seems to be platform specific.

LayoutTests/fast/filesystem/op-copy-expected.txt

 1Got FileSystem: TestShellFileSystem
 2Reseting the filesystem...
 3* Copying an entry to the same directory
 4Reseting the filesystem...
 5PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 6PASS Succeeded: dir1 = parent.getDirectory(name1, create_flag)
 7PASS Succeeded: file2 = parent.getFile(name2, create_flag)
 8PASS Succeeded: copied = dir1.copyTo(parent, name3)
 9PASS Succeeded: parent.getDirectory(name1)
 10PASS Succeeded: parent.getDirectory(name3)
 11PASS Succeeded: copied = file2.copyTo(parent, name4)
 12PASS Succeeded: parent.getDirectory(name1)
 13PASS Succeeded: parent.getDirectory(name3)
 14* Copying entries to a different directory
 15Reseting the filesystem...
 16PASS Succeeded: dir1 = ROOT.getDirectory(name1, create_flag)
 17PASS Succeeded: dir2 = ROOT.getDirectory(name2, create_flag)
 18PASS Succeeded: child3 = dir1.getDirectory(name3, create_flag)
 19PASS Succeeded: child4 = dir1.getFile(name4, create_flag)
 20PASS Succeeded: copied = child3.copyTo(dir2, name1)
 21PASS Succeeded: dir1.getDirectory(name3)
 22PASS Succeeded: dir2.getDirectory(name1)
 23PASS Succeeded: copied = child4.copyTo(dir2, name2)
 24PASS Succeeded: dir1.getFile(name4)
 25PASS Succeeded: dir2.getFile(name2)
 26* Copying entries to with empty names
 27Reseting the filesystem...
 28PASS Succeeded: dir1 = ROOT.getDirectory(name1, create_flag)
 29PASS Succeeded: dir2 = ROOT.getDirectory(name2, create_flag)
 30PASS Succeeded: child3 = dir1.getDirectory(name3, create_flag)
 31PASS Succeeded: child4 = dir1.getFile(name4, create_flag)
 32PASS Succeeded: copied = child3.copyTo(dir2, null)
 33PASS Succeeded: dir1.getDirectory(child3.name)
 34PASS Succeeded: dir2.getDirectory(child3.name)
 35PASS Succeeded: copied = child4.copyTo(dir2, null)
 36PASS Succeeded: dir1.getFile(child4.name)
 37PASS Succeeded: dir2.getFile(child4.name)
 38* Copying entries to the same directory with the same name
 39Reseting the filesystem...
 40PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 41PASS Succeeded: dir1 = parent.getDirectory(name1, create_flag)
 42PASS Succeeded: file2 = parent.getFile(name2, create_flag)
 43PASS this.expectedErrorCode is "13"
 44PASS this.expectedErrorCode is "13"
 45PASS this.expectedErrorCode is "13"
 46PASS this.expectedErrorCode is "13"
 47* Trying to copy non-existent entries
 48PASS Succeeded: nonexist_dir = parent.getDirectory(name3, create_flag)
 49PASS Succeeded: nonexist_file = parent.getFile(name4, create_flag)
 50PASS Succeeded: nonexist_dir.remove()
 51PASS Succeeded: nonexist_file.remove()
 52PASS this.expectedErrorCode is "8"
 53PASS this.expectedErrorCode is "8"
 54PASS this.expectedErrorCode is "8"
 55PASS this.expectedErrorCode is "8"
 56* Copying entries to a non-existent directory
 57PASS this.expectedErrorCode is "8"
 58PASS Succeeded: ROOT.getDirectory(dir1.fullPath)
 59PASS Succeeded: ROOT.getFile(file2.fullPath)
 60PASS this.expectedErrorCode is "8"
 61PASS this.expectedErrorCode is "8"
 62* Copying entries to its child
 63PASS this.expectedErrorCode is "13"
 64PASS this.expectedErrorCode is "13"
 65* Copying a directory with children
 66PASS Succeeded: dir4 = parent.getDirectory(name4, create_flag)
 67PASS Succeeded: child1 = dir4.getFile(name1, create_flag)
 68PASS Succeeded: child2 = dir4.getDirectory(name2, create_flag)
 69PASS Succeeded: child3 = child2.getFile(name3, create_flag)
 70PASS Succeeded: child4 = child2.getDirectory(name4, create_flag)
 71PASS this.vars["entries1"]["length"] is 2
 72PASS this.vars["entries2"]["length"] is 2
 73PASS Succeeded: dir4_copy = dir4.copyTo(ROOT, 'dir4_copy')
 74PASS Succeeded: child2_copy = dir4_copy.getDirectory(name2)
 75PASS this.vars["entries1_copy"]["length"] is 2
 76PASS this.vars["entries2_copy"]["length"] is 2
 77PASS Succeeded: parent.getDirectory(dir4.fullPath)
 78PASS Succeeded: dir4.getFile(name1)
 79PASS Succeeded: dir4.getDirectory(name2)
 80Script execution finished.
 81PASS successfullyParsed is true
 82
 83TEST COMPLETE
 84

LayoutTests/fast/filesystem/op-copy.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="file-system-test-script">
 11 reset()
 12
 13 name1 = 'a'
 14 name2 = 'b'
 15 name3 = 'c'
 16 name4 = 'd'
 17 create_flag = {create:true}
 18
 19 print('* Copying an entry to the same directory')
 20
 21 # Reset
 22 reset()
 23 parent = ROOT.getDirectory('parent', create_flag)
 24 dir1 = parent.getDirectory(name1, create_flag)
 25 file2 = parent.getFile(name2, create_flag)
 26
 27 # Directory
 28 copied = dir1.copyTo(parent, name3)
 29 parent.getDirectory(name1)
 30 parent.getDirectory(name3)
 31
 32 # File
 33 copied = file2.copyTo(parent, name4)
 34 parent.getDirectory(name1)
 35 parent.getDirectory(name3)
 36
 37 print('* Copying entries to a different directory')
 38
 39 # Reset
 40 reset()
 41 dir1 = ROOT.getDirectory(name1, create_flag)
 42 dir2 = ROOT.getDirectory(name2, create_flag)
 43 child3 = dir1.getDirectory(name3, create_flag)
 44 child4 = dir1.getFile(name4, create_flag)
 45
 46 # Directory
 47 copied = child3.copyTo(dir2, name1)
 48 dir1.getDirectory(name3)
 49 dir2.getDirectory(name1)
 50
 51 # File
 52 copied = child4.copyTo(dir2, name2)
 53 dir1.getFile(name4)
 54 dir2.getFile(name2)
 55
 56 print('* Copying entries to with empty names')
 57
 58 # Reset
 59 reset()
 60 dir1 = ROOT.getDirectory(name1, create_flag)
 61 dir2 = ROOT.getDirectory(name2, create_flag)
 62 child3 = dir1.getDirectory(name3, create_flag)
 63 child4 = dir1.getFile(name4, create_flag)
 64
 65 # Directory
 66 copied = child3.copyTo(dir2, null)
 67 dir1.getDirectory(child3.name)
 68 dir2.getDirectory(child3.name)
 69
 70 # File
 71 copied = child4.copyTo(dir2, null)
 72 dir1.getFile(child4.name)
 73 dir2.getFile(child4.name)
 74
 75 print('* Copying entries to the same directory with the same name')
 76
 77 # Reset
 78 reset()
 79 parent = ROOT.getDirectory('parent', create_flag)
 80 dir1 = parent.getDirectory(name1, create_flag)
 81 file2 = parent.getFile(name2, create_flag)
 82
 83 dir1.copyTo(parent, null) raises 13
 84 dir1.copyTo(parent, name1) raises 13
 85 file2.copyTo(parent, null) raises 13
 86 file2.copyTo(parent, name2) raises 13
 87
 88 print('* Trying to copy non-existent entries')
 89
 90 nonexist_dir = parent.getDirectory(name3, create_flag)
 91 nonexist_file = parent.getFile(name4, create_flag)
 92 nonexist_dir.remove()
 93 nonexist_file.remove()
 94
 95 ROOT.getDirectory(nonexist_dir.fullPath) raises 8
 96 ROOT.getFile(nonexist_file.fullPath) raises 8
 97
 98 nonexist_dir.copyTo(dir1, name2) raises 8
 99 nonexist_file.copyTo(dir2, name1) raises 8
 100
 101 print('* Copying entries to a non-existent directory')
 102
 103 ROOT.getDirectory(nonexist_dir.fullPath) raises 8
 104 ROOT.getDirectory(dir1.fullPath)
 105 ROOT.getFile(file2.fullPath)
 106
 107 dir1.copyTo(nonexist_dir, name1) raises 8
 108 file2.copyTo(nonexist_dir, name3) raises 8
 109
 110 print('* Copying entries to its child')
 111
 112 ROOT.copyTo(dir1) raises 13
 113 parent.copyTo(dir1) raises 13
 114
 115 print('* Copying a directory with children')
 116
 117 dir4 = parent.getDirectory(name4, create_flag)
 118 child1 = dir4.getFile(name1, create_flag)
 119 child2 = dir4.getDirectory(name2, create_flag)
 120 child3 = child2.getFile(name3, create_flag)
 121 child4 = child2.getDirectory(name4, create_flag)
 122
 123 entries1 = dir4.readDirectory()
 124 entries2 = child2.readDirectory()
 125 ASSERT_EQ(2, entries1.length)
 126 ASSERT_EQ(2, entries2.length)
 127
 128 dir4_copy = dir4.copyTo(ROOT, 'dir4_copy')
 129 child2_copy = dir4_copy.getDirectory(name2)
 130
 131 entries1_copy = dir4_copy.readDirectory()
 132 entries2_copy = child2_copy.readDirectory()
 133 ASSERT_EQ(2, entries1_copy.length)
 134 ASSERT_EQ(2, entries2_copy.length)
 135
 136 parent.getDirectory(dir4.fullPath)
 137 dir4.getFile(name1)
 138 dir4.getDirectory(name2)
 139
 140</script>
 141<script src="resources/fs-test-shell-temporary.js"></script>
 142<script src="../js/resources/js-test-post.js"></script>
 143</body>
 144</html>

LayoutTests/fast/filesystem/op-get-entry-expected.txt

 1Got FileSystem: TestShellFileSystem
 2* Creating top-level directories and files
 3Reseting the filesystem...
 4PASS Succeeded: dir1 = ROOT.getDirectory(name1, create_flag)
 5PASS Succeeded: file2 = ROOT.getFile(name2, create_flag)
 6PASS this.vars["dir1"]["name"] is this.vars["name1"]
 7PASS this.vars["file2"]["name"] is this.vars["name2"]
 8PASS this.vars["dir1"]["isDirectory"] is this.vars["true"]
 9PASS this.vars["dir1"]["isFile"] is this.vars["false"]
 10PASS this.vars["file2"]["isDirectory"] is this.vars["false"]
 11PASS this.vars["file2"]["isFile"] is this.vars["true"]
 12* Creating nested directories and files
 13PASS Succeeded: dir1_dir2 = dir1.getDirectory(name2, create_flag)
 14PASS Succeeded: dir1_file3 = dir1.getFile(name3, create_flag)
 15PASS this.vars["dir1_dir2"]["fullPath"] is '/a/b'
 16PASS this.vars["dir1_file3"]["fullPath"] is '/a/c'
 17* Creating heavily nested entries
 18Reseting the filesystem...
 19PASS Succeeded: nested1 = ROOT.getDirectory(name1, create_flag)
 20PASS Succeeded: nested2 = nested1.getDirectory(name2, create_flag)
 21PASS Succeeded: nested3 = nested2.getDirectory(name3, create_flag)
 22PASS Succeeded: nested4 = nested3.getDirectory(name4, create_flag)
 23PASS Succeeded: nested5 = nested4.getFile(name1, create_flag)
 24PASS this.vars["nested5"]["fullPath"] is '/a/b/c/d/a'
 25PASS this.vars["nested5"]["name"] is this.vars["name1"]
 26* Getting existing entries
 27Reseting the filesystem...
 28PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 29PASS Succeeded: dir1 = parent.getDirectory(name1, create_flag)
 30PASS Succeeded: file2 = parent.getFile(name2, create_flag)
 31PASS Succeeded: dir1_2 = parent.getDirectory(name1)
 32PASS Succeeded: file2_2 = parent.getFile(name2)
 33PASS this.vars["dir1_2"]["fullPath"] is this.vars["dir1"]["fullPath"]
 34PASS this.vars["file2_2"]["fullPath"] is this.vars["file2"]["fullPath"]
 35* Getting files/directories with full paths.
 36Reseting the filesystem...
 37PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 38PASS Succeeded: dir1 = parent.getDirectory(name1, create_flag)
 39PASS Succeeded: dir2 = parent.getDirectory(name2, create_flag)
 40PASS Succeeded: dir = ROOT.getDirectory('/parent/a/a', create_flag)
 41PASS Succeeded: file = ROOT.getFile('/parent/a/b', create_flag)
 42PASS Succeeded: dir1.getDirectory('a')
 43PASS Succeeded: dir1.getFile('b')
 44PASS Succeeded: dir = dir2.getDirectory('/parent/a/c', create_flag)
 45PASS Succeeded: file = dir2.getFile('/parent/a/d', create_flag)
 46PASS Succeeded: dir1.getDirectory('c')
 47PASS Succeeded: dir1.getFile('d')
 48* Getting files/directories with relative paths.
 49Reseting the filesystem...
 50PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 51PASS Succeeded: dir1 = parent.getDirectory(name1, create_flag)
 52PASS Succeeded: dir2 = dir1.getDirectory(name2, create_flag)
 53PASS Succeeded: dir = dir1.getDirectory('b/a', create_flag)
 54PASS Succeeded: file = dir1.getFile('b/b', create_flag)
 55PASS Succeeded: ROOT.getDirectory('/parent/a/b/a')
 56PASS Succeeded: ROOT.getFile('/parent/a/b/b')
 57PASS Succeeded: parent.getDirectory('a/b/a')
 58PASS Succeeded: parent.getFile('a/b/b')
 59* Trying to get/create entries at non-existent path
 60PASS this.expectedErrorCode is "8"
 61PASS this.expectedErrorCode is "8"
 62PASS this.expectedErrorCode is "8"
 63PASS this.expectedErrorCode is "8"
 64* Calling getFile for a directory, getDirectory for a file
 65Reseting the filesystem...
 66PASS Succeeded: parent = ROOT.getDirectory(name1, create_flag)
 67PASS Succeeded: dir = parent.getDirectory(name2, create_flag)
 68PASS Succeeded: file = parent.getFile(name3, create_flag)
 69PASS this.expectedErrorCode is "11"
 70PASS this.expectedErrorCode is "11"
 71PASS this.expectedErrorCode is "11"
 72PASS this.expectedErrorCode is "11"
 73* Trying to create entries with exclusive flag
 74Reseting the filesystem...
 75PASS Succeeded: parent = ROOT.getDirectory(name1, create_flag)
 76PASS Succeeded: dir = parent.getDirectory(name2, create_flag)
 77PASS Succeeded: file = parent.getFile(name3, create_flag)
 78PASS this.expectedErrorCode is "13"
 79PASS this.expectedErrorCode is "13"
 80PASS this.expectedErrorCode is "13"
 81PASS this.expectedErrorCode is "13"
 82PASS Succeeded: dir.remove()
 83PASS Succeeded: file.remove()
 84PASS Succeeded: ROOT.getDirectory(dir.fullPath, exclusive_flag)
 85PASS Succeeded: ROOT.getFile(file.fullPath, exclusive_flag)
 86PASS Succeeded: dir.remove()
 87PASS Succeeded: file.remove()
 88PASS Succeeded: parent.getDirectory(dir.name, exclusive_flag)
 89PASS Succeeded: parent.getFile(file.name, exclusive_flag)
 90Script execution finished.
 91PASS successfullyParsed is true
 92
 93TEST COMPLETE
 94

LayoutTests/fast/filesystem/op-get-entry.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="file-system-test-script">
 11
 12 name1 = 'a'
 13 name2 = 'b'
 14 name3 = 'c'
 15 name4 = 'd'
 16
 17 create_flag = {create:true}
 18 exclusive_flag = {create:true, exclusive:true}
 19
 20 print('* Creating top-level directories and files')
 21
 22 reset()
 23 dir1 = ROOT.getDirectory(name1, create_flag)
 24 file2 = ROOT.getFile(name2, create_flag)
 25 ASSERT_EQ(name1, dir1.name)
 26 ASSERT_EQ(name2, file2.name)
 27 ASSERT_EQ(true, dir1.isDirectory)
 28 ASSERT_EQ(false, dir1.isFile)
 29 ASSERT_EQ(false, file2.isDirectory)
 30 ASSERT_EQ(true, file2.isFile)
 31
 32 print('* Creating nested directories and files')
 33
 34 dir1_dir2 = dir1.getDirectory(name2, create_flag)
 35 dir1_file3 = dir1.getFile(name3, create_flag)
 36 ASSERT_EQ('/a/b', dir1_dir2.fullPath)
 37 ASSERT_EQ('/a/c', dir1_file3.fullPath)
 38
 39 print('* Creating heavily nested entries')
 40
 41 reset()
 42 nested1 = ROOT.getDirectory(name1, create_flag)
 43 nested2 = nested1.getDirectory(name2, create_flag)
 44 nested3 = nested2.getDirectory(name3, create_flag)
 45 nested4 = nested3.getDirectory(name4, create_flag)
 46 nested5 = nested4.getFile(name1, create_flag)
 47 ASSERT_EQ('/a/b/c/d/a', nested5.fullPath)
 48 ASSERT_EQ(name1, nested5.name)
 49
 50 print('* Getting existing entries')
 51
 52 reset()
 53 parent = ROOT.getDirectory('parent', create_flag)
 54 dir1 = parent.getDirectory(name1, create_flag)
 55 file2 = parent.getFile(name2, create_flag)
 56
 57 dir1_2 = parent.getDirectory(name1)
 58 file2_2 = parent.getFile(name2)
 59 ASSERT_EQ(dir1.fullPath, dir1_2.fullPath)
 60 ASSERT_EQ(file2.fullPath, file2_2.fullPath)
 61
 62 print('* Getting files/directories with full paths.')
 63
 64 reset()
 65 parent = ROOT.getDirectory('parent', create_flag)
 66 dir1 = parent.getDirectory(name1, create_flag)
 67 dir2 = parent.getDirectory(name2, create_flag)
 68
 69 dir = ROOT.getDirectory('/parent/a/a', create_flag)
 70 file = ROOT.getFile('/parent/a/b', create_flag)
 71 dir1.getDirectory('a')
 72 dir1.getFile('b')
 73
 74 # The entry's path must not be used if the given path is a full path.
 75 dir = dir2.getDirectory('/parent/a/c', create_flag)
 76 file = dir2.getFile('/parent/a/d', create_flag)
 77 dir1.getDirectory('c')
 78 dir1.getFile('d')
 79
 80 print('* Getting files/directories with relative paths.')
 81
 82 reset()
 83 parent = ROOT.getDirectory('parent', create_flag)
 84 dir1 = parent.getDirectory(name1, create_flag)
 85 dir2 = dir1.getDirectory(name2, create_flag)
 86
 87 dir = dir1.getDirectory('b/a', create_flag)
 88 file = dir1.getFile('b/b', create_flag)
 89 ROOT.getDirectory('/parent/a/b/a')
 90 ROOT.getFile('/parent/a/b/b')
 91 parent.getDirectory('a/b/a')
 92 parent.getFile('a/b/b')
 93
 94 print('* Trying to get/create entries at non-existent path')
 95
 96 dir1.getFile('nonexistent') raises 8
 97 dir1.getDirectory('nonexistent') raises 8
 98 dir1.getFile('nonexistent/d', create_flag) raises 8
 99 dir1.getDirectory('nonexistent/d', create_flag) raises 8
 100
 101 print('* Calling getFile for a directory, getDirectory for a file')
 102
 103 reset()
 104 parent = ROOT.getDirectory(name1, create_flag)
 105 dir = parent.getDirectory(name2, create_flag)
 106 file = parent.getFile(name3, create_flag)
 107
 108 ROOT.getDirectory(file.fullPath) raises 11
 109 ROOT.getFile(dir.fullPath) raises 11
 110 parent.getDirectory(file.name) raises 11
 111 parent.getFile(dir.name) raises 11
 112
 113 print('* Trying to create entries with exclusive flag')
 114
 115 reset()
 116 parent = ROOT.getDirectory(name1, create_flag)
 117 dir = parent.getDirectory(name2, create_flag)
 118 file = parent.getFile(name3, create_flag)
 119
 120 ROOT.getDirectory(dir.fullPath, exclusive_flag) raises 13
 121 ROOT.getFile(file.fullPath, exclusive_flag) raises 13
 122 parent.getDirectory(dir.name, exclusive_flag) raises 13
 123 parent.getFile(file.name, exclusive_flag) raises 13
 124
 125 dir.remove()
 126 file.remove()
 127
 128 # Now this should succeed.
 129 ROOT.getDirectory(dir.fullPath, exclusive_flag)
 130 ROOT.getFile(file.fullPath, exclusive_flag)
 131
 132 dir.remove()
 133 file.remove()
 134
 135 # Now this should succeed.
 136 parent.getDirectory(dir.name, exclusive_flag)
 137 parent.getFile(file.name, exclusive_flag)
 138
 139</script>
 140<script src="resources/fs-test-shell-temporary.js"></script>
 141<script src="../js/resources/js-test-post.js"></script>
 142</body>
 143</html>

LayoutTests/fast/filesystem/op-get-metadata-expected.txt

 1Got FileSystem: TestShellFileSystem
 2PASS Succeeded: start = ROOT.getMetadata();
 3Reseting the filesystem...
 4PASS Succeeded: dir1 = ROOT.getDirectory(name1, create_flag)
 5PASS Succeeded: file2 = ROOT.getFile(name2, create_flag)
 6PASS Succeeded: dir1_file1 = dir1.getFile(name1, create_flag)
 7PASS Succeeded: dir1_dir2 = dir1.getDirectory(name2, create_flag)
 8* Get metadata for directories
 9PASS Succeeded: metadata = dir1.getMetadata()
 10PASS Succeeded: metadata = dir1_dir2.getMetadata()
 11* Get metadata for files
 12PASS Succeeded: metadata = file2.getMetadata()
 13PASS Succeeded: metadata = dir1_file1.getMetadata()
 14PASS Succeeded: end = dir1_file1.getMetadata()
 15PASS "[object Metadata]" is >= "[object Metadata]"
 16Script execution finished.
 17PASS successfullyParsed is true
 18
 19TEST COMPLETE
 20

LayoutTests/fast/filesystem/op-get-metadata.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="file-system-test-script">
 11
 12 start = ROOT.getMetadata();
 13 reset()
 14
 15 name1 = 'a'
 16 name2 = 'b'
 17 create_flag = {create:true}
 18
 19 dir1 = ROOT.getDirectory(name1, create_flag)
 20 file2 = ROOT.getFile(name2, create_flag)
 21 dir1_file1 = dir1.getFile(name1, create_flag)
 22 dir1_dir2 = dir1.getDirectory(name2, create_flag)
 23
 24 print('* Get metadata for directories')
 25 metadata = dir1.getMetadata()
 26 metadata = dir1_dir2.getMetadata()
 27
 28 print('* Get metadata for files')
 29 metadata = file2.getMetadata()
 30 metadata = dir1_file1.getMetadata()
 31
 32 # Make sure we get the newer timestamp.
 33 end = dir1_file1.getMetadata()
 34 ASSERT_GE(end, start)
 35
 36</script>
 37<script src="resources/fs-test-shell-temporary.js"></script>
 38<script src="../js/resources/js-test-post.js"></script>
 39</body>
 40</html>

LayoutTests/fast/filesystem/op-get-parent-expected.txt

 1Got FileSystem: TestShellFileSystem
 2* Getting a parent of entries.
 3Reseting the filesystem...
 4PASS Succeeded: dir1 = ROOT.getDirectory(name1, create_flag)
 5PASS Succeeded: dir2 = dir1.getDirectory(name2, create_flag)
 6PASS Succeeded: file3 = dir2.getFile(name3, create_flag)
 7PASS Succeeded: parent = file3.getParent()
 8PASS this.vars["dir2"]["fullPath"] is this.vars["parent"]["fullPath"]
 9PASS Succeeded: parent = dir2.getParent()
 10PASS this.vars["dir1"]["fullPath"] is this.vars["parent"]["fullPath"]
 11PASS Succeeded: parent = dir1.getParent()
 12PASS this.vars["ROOT"]["fullPath"] is this.vars["parent"]["fullPath"]
 13PASS Succeeded: parent = ROOT.getParent()
 14PASS this.vars["ROOT"]["fullPath"] is this.vars["parent"]["fullPath"]
 15Script execution finished.
 16PASS successfullyParsed is true
 17
 18TEST COMPLETE
 19

LayoutTests/fast/filesystem/op-get-parent.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="file-system-test-script">
 11
 12 name1 = 'a'
 13 name2 = 'b'
 14 name3 = 'c'
 15
 16 create_flag = {create:true}
 17
 18 print('* Getting a parent of entries.')
 19
 20 reset()
 21 dir1 = ROOT.getDirectory(name1, create_flag)
 22 dir2 = dir1.getDirectory(name2, create_flag)
 23 file3 = dir2.getFile(name3, create_flag)
 24
 25 parent = file3.getParent()
 26 ASSERT_EQ(parent.fullPath, dir2.fullPath)
 27
 28 parent = dir2.getParent()
 29 ASSERT_EQ(parent.fullPath, dir1.fullPath)
 30
 31 parent = dir1.getParent()
 32 ASSERT_EQ(parent.fullPath, ROOT.fullPath)
 33
 34 parent = ROOT.getParent()
 35 ASSERT_EQ(parent.fullPath, ROOT.fullPath)
 36
 37</script>
 38<script src="resources/fs-test-shell-temporary.js"></script>
 39<script src="../js/resources/js-test-post.js"></script>
 40</body>
 41</html>
 42
 43

LayoutTests/fast/filesystem/op-move-expected.txt

 1Got FileSystem: TestShellFileSystem
 2Reseting the filesystem...
 3* Moving an entry to the same directory
 4Reseting the filesystem...
 5PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 6PASS Succeeded: dir1 = parent.getDirectory(name1, create_flag)
 7PASS Succeeded: file2 = parent.getFile(name2, create_flag)
 8PASS Succeeded: moved = dir1.moveTo(parent, name3)
 9PASS this.expectedErrorCode is "8"
 10PASS Succeeded: parent.getDirectory(name3)
 11PASS Succeeded: moved = file2.moveTo(parent, name4)
 12PASS this.expectedErrorCode is "8"
 13PASS Succeeded: parent.getDirectory(name3)
 14* Moving entries to a different directory
 15Reseting the filesystem...
 16PASS Succeeded: dir1 = ROOT.getDirectory(name1, create_flag)
 17PASS Succeeded: dir2 = ROOT.getDirectory(name2, create_flag)
 18PASS Succeeded: child3 = dir1.getDirectory(name3, create_flag)
 19PASS Succeeded: child4 = dir1.getFile(name4, create_flag)
 20PASS Succeeded: moved = child3.moveTo(dir2, name1)
 21PASS this.expectedErrorCode is "8"
 22PASS Succeeded: dir2.getDirectory(name1)
 23PASS Succeeded: moved = child4.moveTo(dir2, name2)
 24PASS this.expectedErrorCode is "8"
 25PASS Succeeded: dir2.getFile(name2)
 26* Moving entries to with empty names
 27Reseting the filesystem...
 28PASS Succeeded: dir1 = ROOT.getDirectory(name1, create_flag)
 29PASS Succeeded: dir2 = ROOT.getDirectory(name2, create_flag)
 30PASS Succeeded: child3 = dir1.getDirectory(name3, create_flag)
 31PASS Succeeded: child4 = dir1.getFile(name4, create_flag)
 32PASS Succeeded: moved = child3.moveTo(dir2, null)
 33PASS this.expectedErrorCode is "8"
 34PASS Succeeded: dir2.getDirectory(child3.name)
 35PASS Succeeded: moved = child4.moveTo(dir2, null)
 36PASS this.expectedErrorCode is "8"
 37PASS Succeeded: dir2.getFile(child4.name)
 38* Moving entries to the same directory with the same name
 39Reseting the filesystem...
 40PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 41PASS Succeeded: dir1 = parent.getDirectory(name1, create_flag)
 42PASS Succeeded: file2 = parent.getFile(name2, create_flag)
 43PASS this.expectedErrorCode is "13"
 44PASS this.expectedErrorCode is "13"
 45PASS this.expectedErrorCode is "13"
 46PASS this.expectedErrorCode is "13"
 47* Trying to move non-existent entries
 48PASS Succeeded: nonexist_dir = parent.getDirectory(name3, create_flag)
 49PASS Succeeded: nonexist_file = parent.getFile(name4, create_flag)
 50PASS Succeeded: nonexist_dir.remove()
 51PASS Succeeded: nonexist_file.remove()
 52PASS this.expectedErrorCode is "8"
 53PASS this.expectedErrorCode is "8"
 54PASS this.expectedErrorCode is "8"
 55PASS this.expectedErrorCode is "8"
 56* Moving entries to a non-existent directory
 57PASS this.expectedErrorCode is "8"
 58PASS Succeeded: ROOT.getDirectory(dir1.fullPath)
 59PASS Succeeded: ROOT.getFile(file2.fullPath)
 60PASS this.expectedErrorCode is "8"
 61PASS this.expectedErrorCode is "8"
 62* Moving entries to its child
 63PASS this.expectedErrorCode is "13"
 64PASS this.expectedErrorCode is "13"
 65* Moving a directory with children
 66PASS Succeeded: dir4 = parent.getDirectory(name4, create_flag)
 67PASS Succeeded: child1 = dir4.getFile(name1, create_flag)
 68PASS Succeeded: child2 = dir4.getDirectory(name2, create_flag)
 69PASS Succeeded: child3 = child2.getFile(name3, create_flag)
 70PASS Succeeded: child4 = child2.getDirectory(name4, create_flag)
 71PASS this.vars["entries1"]["length"] is 2
 72PASS this.vars["entries2"]["length"] is 2
 73PASS Succeeded: dir4_new = dir4.moveTo(ROOT, 'dir4_new')
 74PASS Succeeded: child2_new = dir4_new.getDirectory(name2)
 75PASS this.vars["entries1_new"]["length"] is 2
 76PASS this.vars["entries2_new"]["length"] is 2
 77PASS this.expectedErrorCode is "8"
 78Script execution finished.
 79PASS successfullyParsed is true
 80
 81TEST COMPLETE
 82

LayoutTests/fast/filesystem/op-move.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="file-system-test-script">
 11 reset()
 12
 13 name1 = 'a'
 14 name2 = 'b'
 15 name3 = 'c'
 16 name4 = 'd'
 17 create_flag = {create:true}
 18
 19 print('* Moving an entry to the same directory')
 20
 21 # Reset
 22 reset()
 23 parent = ROOT.getDirectory('parent', create_flag)
 24 dir1 = parent.getDirectory(name1, create_flag)
 25 file2 = parent.getFile(name2, create_flag)
 26
 27 # Directory
 28 moved = dir1.moveTo(parent, name3)
 29 parent.getDirectory(name1) raises 8
 30 parent.getDirectory(name3)
 31
 32 # File
 33 moved = file2.moveTo(parent, name4)
 34 parent.getDirectory(name1) raises 8
 35 parent.getDirectory(name3)
 36
 37 print('* Moving entries to a different directory')
 38
 39 # Reset
 40 reset()
 41 dir1 = ROOT.getDirectory(name1, create_flag)
 42 dir2 = ROOT.getDirectory(name2, create_flag)
 43 child3 = dir1.getDirectory(name3, create_flag)
 44 child4 = dir1.getFile(name4, create_flag)
 45
 46 # Directory
 47 moved = child3.moveTo(dir2, name1)
 48 dir1.getDirectory(name3) raises 8
 49 dir2.getDirectory(name1)
 50
 51 # File
 52 moved = child4.moveTo(dir2, name2)
 53 dir1.getFile(name4) raises 8
 54 dir2.getFile(name2)
 55
 56 print('* Moving entries to with empty names')
 57
 58 # Reset
 59 reset()
 60 dir1 = ROOT.getDirectory(name1, create_flag)
 61 dir2 = ROOT.getDirectory(name2, create_flag)
 62 child3 = dir1.getDirectory(name3, create_flag)
 63 child4 = dir1.getFile(name4, create_flag)
 64
 65 # Directory
 66 moved = child3.moveTo(dir2, null)
 67 dir1.getDirectory(child3.name) raises 8
 68 dir2.getDirectory(child3.name)
 69
 70 # File
 71 moved = child4.moveTo(dir2, null)
 72 dir1.getFile(child4.name) raises 8
 73 dir2.getFile(child4.name)
 74
 75 print('* Moving entries to the same directory with the same name')
 76
 77 # Reset
 78 reset()
 79 parent = ROOT.getDirectory('parent', create_flag)
 80 dir1 = parent.getDirectory(name1, create_flag)
 81 file2 = parent.getFile(name2, create_flag)
 82
 83 dir1.moveTo(parent, null) raises 13
 84 dir1.moveTo(parent, name1) raises 13
 85 file2.moveTo(parent, null) raises 13
 86 file2.moveTo(parent, name2) raises 13
 87
 88 print('* Trying to move non-existent entries')
 89
 90 nonexist_dir = parent.getDirectory(name3, create_flag)
 91 nonexist_file = parent.getFile(name4, create_flag)
 92 nonexist_dir.remove()
 93 nonexist_file.remove()
 94
 95 ROOT.getDirectory(nonexist_dir.fullPath) raises 8
 96 ROOT.getFile(nonexist_file.fullPath) raises 8
 97
 98 nonexist_dir.moveTo(dir1, name2) raises 8
 99 nonexist_file.moveTo(dir2, name1) raises 8
 100
 101 print('* Moving entries to a non-existent directory')
 102
 103 ROOT.getDirectory(nonexist_dir.fullPath) raises 8
 104 ROOT.getDirectory(dir1.fullPath)
 105 ROOT.getFile(file2.fullPath)
 106
 107 dir1.moveTo(nonexist_dir, name1) raises 8
 108 file2.moveTo(nonexist_dir, name3) raises 8
 109
 110 print('* Moving entries to its child')
 111
 112 ROOT.moveTo(dir1) raises 13
 113 parent.moveTo(dir1) raises 13
 114
 115 print('* Moving a directory with children')
 116
 117 dir4 = parent.getDirectory(name4, create_flag)
 118 child1 = dir4.getFile(name1, create_flag)
 119 child2 = dir4.getDirectory(name2, create_flag)
 120 child3 = child2.getFile(name3, create_flag)
 121 child4 = child2.getDirectory(name4, create_flag)
 122
 123 entries1 = dir4.readDirectory()
 124 entries2 = child2.readDirectory()
 125 ASSERT_EQ(2, entries1.length)
 126 ASSERT_EQ(2, entries2.length)
 127
 128 dir4_new = dir4.moveTo(ROOT, 'dir4_new')
 129 child2_new = dir4_new.getDirectory(name2)
 130
 131 entries1_new = dir4_new.readDirectory()
 132 entries2_new = child2_new.readDirectory()
 133 ASSERT_EQ(2, entries1_new.length)
 134 ASSERT_EQ(2, entries2_new.length)
 135
 136 parent.getDirectory(dir4.fullPath) raises 8
 137
 138</script>
 139<script src="resources/fs-test-shell-temporary.js"></script>
 140<script src="../js/resources/js-test-post.js"></script>
 141</body>
 142</html>

LayoutTests/fast/filesystem/op-read-directory-expected.txt

 1Got FileSystem: TestShellFileSystem
 2Reseting the filesystem...
 3PASS this.vars["entries"]["length"] is 0
 4PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 5PASS Succeeded: a = parent.getDirectory('a', create_flag)
 6PASS Succeeded: b = parent.getDirectory('b', create_flag)
 7PASS Succeeded: c = parent.getDirectory('c', create_flag)
 8PASS Succeeded: d = parent.getFile('d', create_flag)
 9PASS Succeeded: e = parent.getFile('e', create_flag)
 10PASS Succeeded: f = parent.getDirectory('f', create_flag)
 11PASS Succeeded: g = parent.getFile('g', create_flag)
 12PASS Succeeded: c.getFile('h', create_flag)
 13PASS Succeeded: c.getDirectory('i', create_flag)
 14PASS Succeeded: f.getFile('j', create_flag)
 15PASS this.vars["entries"]["length"] is 1
 16PASS this.vars["entries"]["length"] is 7
 17[ENTRY {path:/parent/a name:a type:DIRECTORY},
 18 ENTRY {path:/parent/b name:b type:DIRECTORY},
 19 ENTRY {path:/parent/c name:c type:DIRECTORY},
 20 ENTRY {path:/parent/d name:d type:FILE},
 21 ENTRY {path:/parent/e name:e type:FILE},
 22 ENTRY {path:/parent/f name:f type:DIRECTORY},
 23 ENTRY {path:/parent/g name:g type:FILE}]
 24PASS Succeeded: g.remove()
 25PASS Succeeded: b.remove()
 26PASS this.vars["entries"]["length"] is 5
 27[ENTRY {path:/parent/a name:a type:DIRECTORY},
 28 ENTRY {path:/parent/c name:c type:DIRECTORY},
 29 ENTRY {path:/parent/d name:d type:FILE},
 30 ENTRY {path:/parent/e name:e type:FILE},
 31 ENTRY {path:/parent/f name:f type:DIRECTORY}]
 32Script execution finished.
 33PASS successfullyParsed is true
 34
 35TEST COMPLETE
 36

LayoutTests/fast/filesystem/op-read-directory.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="file-system-test-script">
 11
 12 name1 = 'a'
 13 name2 = 'b'
 14 name3 = 'c'
 15 name4 = 'd'
 16
 17 create_flag = {create:true}
 18
 19 reset()
 20
 21 entries = ROOT.readDirectory()
 22 ASSERT_EQ(0, entries.length)
 23
 24 parent = ROOT.getDirectory('parent', create_flag)
 25 a = parent.getDirectory('a', create_flag)
 26 b = parent.getDirectory('b', create_flag)
 27 c = parent.getDirectory('c', create_flag)
 28 d = parent.getFile('d', create_flag)
 29 e = parent.getFile('e', create_flag)
 30 f = parent.getDirectory('f', create_flag)
 31 g = parent.getFile('g', create_flag)
 32
 33 c.getFile('h', create_flag)
 34 c.getDirectory('i', create_flag)
 35 f.getFile('j', create_flag)
 36
 37 entries = ROOT.readDirectory()
 38 ASSERT_EQ(1, entries.length)
 39
 40 entries = parent.readDirectory()
 41 ASSERT_EQ(7, entries.length)
 42 print(entries)
 43
 44 g.remove()
 45 b.remove()
 46 entries = parent.readDirectory()
 47 ASSERT_EQ(5, entries.length)
 48 print(entries)
 49
 50</script>
 51<script src="resources/fs-test-shell-temporary.js"></script>
 52<script src="../js/resources/js-test-post.js"></script>
 53</body>
 54</html>

LayoutTests/fast/filesystem/op-remove-expected.txt

 1Got FileSystem: TestShellFileSystem
 2* Removing files and directories
 3Reseting the filesystem...
 4PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 5PASS Succeeded: dir1 = parent.getDirectory(name1, create_flag)
 6PASS Succeeded: file2 = parent.getFile(name2, create_flag)
 7PASS Succeeded: parent.getDirectory(name1)
 8PASS Succeeded: parent.getFile(name2)
 9PASS Succeeded: dir1.remove()
 10PASS Succeeded: file2.remove()
 11PASS this.expectedErrorCode is "8"
 12PASS this.expectedErrorCode is "8"
 13* Removing non-existent file or directory
 14PASS this.expectedErrorCode is "8"
 15PASS this.expectedErrorCode is "8"
 16* Removing a directory with children
 17Reseting the filesystem...
 18PASS Succeeded: parent = ROOT.getDirectory('parent', create_flag)
 19PASS Succeeded: dir1 = parent.getDirectory(name1, create_flag)
 20PASS Succeeded: file2 = parent.getFile(name2, create_flag)
 21PASS this.expectedErrorCode is "13"
 22Script execution finished.
 23PASS successfullyParsed is true
 24
 25TEST COMPLETE
 26

LayoutTests/fast/filesystem/op-remove.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="file-system-test-script">
 11
 12 name1 = 'a'
 13 name2 = 'b'
 14
 15 create_flag = {create:true}
 16
 17 print('* Removing files and directories')
 18
 19 reset()
 20 parent = ROOT.getDirectory('parent', create_flag)
 21 dir1 = parent.getDirectory(name1, create_flag)
 22 file2 = parent.getFile(name2, create_flag)
 23
 24 # Make sure the entries exist
 25 parent.getDirectory(name1)
 26 parent.getFile(name2)
 27
 28 dir1.remove()
 29 file2.remove()
 30
 31 # Now they should be gone away
 32 parent.getDirectory(name1) raises 8
 33 parent.getFile(name2) raises 8
 34
 35 print('* Removing non-existent file or directory')
 36
 37 dir1.remove() raises 8
 38 file2.remove() raises 8
 39
 40 print('* Removing a directory with children')
 41
 42 reset()
 43 parent = ROOT.getDirectory('parent', create_flag)
 44 dir1 = parent.getDirectory(name1, create_flag)
 45 file2 = parent.getFile(name2, create_flag)
 46
 47 parent.remove() raises 13
 48
 49</script>
 50<script src="resources/fs-test-shell-temporary.js"></script>
 51<script src="../js/resources/js-test-post.js"></script>
 52</body>
 53</html>
 54

LayoutTests/fast/filesystem/parallel-operations-expected.txt

 1Test making multiple FileSystem operations in parallel.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Got FileSystem:TestShellFileSystem
 7requested FileSystem.
 8Starting parallel test stage 1.
 9Starting parallel test stage 2.
 10Verifying the FileSystem status.
 11PASS "/a,/b2,/c,/d,/e" is "/a,/b2,/c,/d,/e"
 12PASS successfullyParsed is true
 13
 14TEST COMPLETE
 15

LayoutTests/fast/filesystem/parallel-operations.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6</head>
 7<body>
 8<p id="description"></p>
 9<div id="console"></div>
 10<script src="script-tests/parallel-operations.js"></script>
 11<script src="../js/resources/js-test-post.js"></script>
 12</body>
 13</html>

LayoutTests/fast/filesystem/request-fs-twice-persistent-expected.txt

 1Got FileSystem: TestShellFileSystem
 2Reseting the filesystem...
 3PASS Succeeded: ROOT.getDirectory('aa', {create:true});
 4Script execution finished.
 5Got FileSystem: TestShellFileSystem
 6PASS this.vars["entries"]["length"] is 1
 7PASS this.vars["entry"]["fullPath"] is '/aa'
 8Script execution finished.
 9PASS successfullyParsed is true
 10
 11TEST COMPLETE
 12

LayoutTests/fast/filesystem/request-fs-twice-persistent.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="script1">
 11 reset();
 12 ROOT.getDirectory('aa', {create:true});
 13</script>
 14<script type="application/file-system-test-shell" id="script2">
 15 # See if we get the same file system.
 16 entries = ROOT.readDirectory();
 17 entry = entries[0]
 18 ASSERT_EQ(1, entries.length);
 19 ASSERT_EQ('/aa', entry.fullPath);
 20</script>
 21<script>
 22function runSecondTest() {
 23 var shell = new FileSystemTestShell(PERSISTENT, 100, debug, function(){
 24 finishJSTest();
 25 });
 26 shell.runScripts('script2');
 27}
 28
 29if (window.requestFileSystem) {
 30 window.jsTestIsAsync = true;
 31 var shell = new FileSystemTestShell(PERSISTENT, 100, debug, runSecondTest);
 32 shell.runScripts('script1');
 33} else
 34 debug("This test requires FileSystem API support.");
 35
 36window.successfullyParsed = true;
 37</script>
 38<script src="../js/resources/js-test-post.js"></script>
 39</body>
 40</html>

LayoutTests/fast/filesystem/request-fs-twice-temporary-expected.txt

 1Got FileSystem: TestShellFileSystem
 2Reseting the filesystem...
 3PASS Succeeded: ROOT.getDirectory('aa', {create:true});
 4Script execution finished.
 5Got FileSystem: TestShellFileSystem
 6PASS this.vars["entries"]["length"] is 1
 7PASS this.vars["entry"]["fullPath"] is '/aa'
 8Script execution finished.
 9PASS successfullyParsed is true
 10
 11TEST COMPLETE
 12

LayoutTests/fast/filesystem/request-fs-twice-temporary.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="script1">
 11 reset();
 12 ROOT.getDirectory('aa', {create:true});
 13</script>
 14<script type="application/file-system-test-shell" id="script2">
 15 # See if we get the same file system.
 16 entries = ROOT.readDirectory();
 17 entry = entries[0]
 18 ASSERT_EQ(1, entries.length);
 19 ASSERT_EQ('/aa', entry.fullPath);
 20</script>
 21<script>
 22function runSecondTest() {
 23 var shell = new FileSystemTestShell(TEMPORARY, 100, debug, function(){
 24 finishJSTest();
 25 });
 26 shell.runScripts('script2');
 27}
 28
 29if (window.requestFileSystem) {
 30 window.jsTestIsAsync = true;
 31 var shell = new FileSystemTestShell(TEMPORARY, 100, debug, runSecondTest);
 32 shell.runScripts('script1');
 33} else
 34 debug("This test requires FileSystem API support.");
 35
 36window.successfullyParsed = true;
 37</script>
 38<script src="../js/resources/js-test-post.js"></script>
 39</body>
 40</html>

LayoutTests/fast/filesystem/resources/fs-test-shell-temporary.js

 1function endTest() {
 2 finishJSTest();
 3}
 4
 5if (window.requestFileSystem) {
 6 window.jsTestIsAsync = true;
 7 var shell = new FileSystemTestShell(TEMPORARY, 100, debug, endTest);
 8 shell.runScripts('file-system-test-script');
 9} else
 10 debug("This test requires FileSystem API support.");
 11
 12window.successfullyParsed = true;

LayoutTests/fast/filesystem/resources/fs-test-shell.js

 1/*
 2 Available variables and functions:
 3 <entry>.<entryMethod>(...) [raise <code>]
 4 ... Calls the entry method synchronously. It does not error out if "raise <code>" is given and it has thrown the error code <code>.
 5 reset() ... Removes all entries in the file system.
 6 print(<arg>) ... Prints out the given arg.
 7 ASSERT_EQ(<arg1>, <arg2>) ... Asserts that <arg1> and <arg2> are equal.
 8 ASSERT_GE(<arg1>, <arg2>) ... Asserts that <arg1> is greater than or equals to <arg2>.
 9 ROOT ... The file system's root entry.
 10
 11 Example:
 12 -------------------------------------------------------------------------
 13 <div id="file-system-test-script">
 14 reset()
 15
 16 # comment
 17 entry1 = ROOT.getFile('foo/a.txt')
 18 entry2 = ROOT.getDirectory('foo/bar', {CREATE:true})
 19 entry3 = ROOT.getFile('foo/nonexistent') raises 8
 20 entries = ROOT.readDirectory()
 21 print(entries)
 22 entry1.copyTo(entry2, 'b.txt')
 23 metadata = entry1.getMetadata()
 24 print(metadata)
 25 ASSERT_GT(metadata, 0)
 26 </div>
 27
 28 var shell = new FileSystemTestShell(TEMPORARY, 100);
 29 shell.runScripts("file-system-test-script");
 30 -------------------------------------------------------------------------
 31 */
 32
 33var FileSystemTestShell = function(type, size, opt_logFunc, opt_endTestCallback)
 34{
 35 this.fileSystem = null;
 36 this.fileSystemType = type;
 37 this.fileSystemSize = size;
 38
 39 this.log = opt_logFunc;
 40 this.endTestCallback = opt_endTestCallback;
 41
 42 this.lines = [];
 43 this.lineCounter = -1;
 44 this.statement = '';
 45 this.expectedErrorCode = 0;
 46 this.destinationSymbol = null;
 47 this.directoryReader = null;
 48
 49 this.vars = { 'true': true, 'false': false };
 50 this.argSymbols = [];
 51
 52 this.runScripts = function(elementId)
 53 {
 54 if (!this.endTestCallback)
 55 this.endTestCallback = function() { };
 56
 57 if (!this.log)
 58 this.log = this.defaultLogFunc;
 59
 60 var elem = document.getElementById(elementId);
 61 if (!elem) {
 62 this.error('Element not found: ' + elementId);
 63 return;
 64 }
 65 this.lines = elem.innerHTML.split(/\r?\n+/);
 66 if (!this.lines.length) {
 67 this.error("No scripts to run!");
 68 return;
 69 }
 70
 71 this.lineCounter = 0;
 72 requestFileSystem(this.fileSystemType, this.fileSystemSize, this.bind(this.fileSystemCallback), this.bind(this.errorCallback));
 73 }
 74
 75 // Callbacks ------------------------------------------------------------
 76
 77 this.bind = function(callback, arg1, arg2, arg3)
 78 {
 79 var obj = this;
 80 return function(arg) {
 81 if (arg == undefined)
 82 callback.apply(obj, [arg1, arg2, arg3]);
 83 else
 84 callback.apply(obj, [arg, arg1, arg2, arg3]);
 85 };
 86 };
 87
 88 this.errorCallback = function(error)
 89 {
 90 if (window.shouldBe)
 91 shouldBe.apply(this, ["this.expectedErrorCode", '"' + error.code + '"']);
 92 if (this.expectedErrorCode && error.code == this.expectedErrorCode) {
 93 this.runNextStatement();
 94 } else {
 95 this.error('Got error: ' + error.code);
 96 }
 97 }
 98
 99 this.successCallback = function(returnValue)
 100 {
 101 if (this.expectedErrorCode) {
 102 this.error('Operation unexpectedly succeeded');
 103 return;
 104 }
 105 if (this.destinationSymbol)
 106 this.vars[this.destinationSymbol] = returnValue;
 107 if (this.statement && window.testPassed)
 108 testPassed('Succeeded: ' + this.statement);
 109 this.runNextStatement();
 110 }
 111
 112 this.entriesCallback = function(entries)
 113 {
 114 if (this.destinationSymbol) {
 115 if (!this.vars[this.destinationSymbol])
 116 this.vars[this.destinationSymbol] = [];
 117 for (var i = 0; i < entries.length; ++i)
 118 this.vars[this.destinationSymbol].push(entries[i]);
 119 }
 120 if (entries.length)
 121 this.directoryReader.readEntries(this.bind(this.entriesCallback), this.bind(this.errorCallback));
 122 else
 123 this.runNextStatement();
 124 }
 125
 126 this.fileSystemCallback = function(fs)
 127 {
 128 this.log('Got FileSystem: ' + fs.name);
 129 this.fileSystem = fs;
 130 this.vars['ROOT'] = fs.root;
 131 this.runNextStatement();
 132 }
 133
 134 // Helper methods for calling entry methods -----------------------------
 135
 136 var callEntryMethod0 = function(shell, entry, method, args)
 137 {
 138 try {
 139 entry[method](shell.bind(shell.successCallback), shell.bind(shell.errorCallback));
 140 } catch (exception) {
 141 if (shell.expectedErrorCode && error.code == shell.expectedErrorCode) {
 142 shell.log('Got exception (expected): ' + error.code);
 143 shell.runNextStatement();
 144 } else {
 145 shell.error('Got exception: ' + error.code);
 146 }
 147 }
 148 }
 149
 150 var callEntryMethod2 = function(shell, entry, method, args)
 151 {
 152 try {
 153 entry[method](args[0], args[1], shell.bind(shell.successCallback), shell.bind(shell.errorCallback));
 154 } catch (exception) {
 155 if (shell.expectedErrorCode && error.code == shell.expectedErrorCode) {
 156 shell.log('Got exception (expected): ' + error.code);
 157 shell.runNextStatement();
 158 } else {
 159 shell.error('Got exception: ' + error.code);
 160 }
 161 }
 162 }
 163
 164 var callReadDirectory = function(shell, entry, method, args)
 165 {
 166 try {
 167 shell.directoryReader = entry.createReader();
 168 shell.directoryReader.readEntries(shell.bind(shell.entriesCallback), shell.bind(shell.errorCallback));
 169 } catch (exception) {
 170 if (shell.expectedErrorCode && error.code == shell.expectedErrorCode) {
 171 shell.log('Got exception (expected): ' + error.code);
 172 shell.runNextStatement();
 173 } else {
 174 shell.error('Got exception: ' + error.code);
 175 }
 176 }
 177 }
 178
 179 var entryMethodsTable = {
 180 'getMetadata': callEntryMethod0,
 181 'copyTo': callEntryMethod2,
 182 'moveTo': callEntryMethod2,
 183 'remove': callEntryMethod0,
 184 'getParent': callEntryMethod0,
 185 'getFile': callEntryMethod2,
 186 'getDirectory': callEntryMethod2,
 187 'readDirectory': callReadDirectory,
 188 };
 189
 190 // Built-in funcitons ---------------------------------------------------
 191
 192 var toString = function(obj)
 193 {
 194 if (obj == undefined) {
 195 return "undefined";
 196 } else if (typeof obj == 'object') {
 197 if (obj.length != undefined) {
 198 var stringArray = [];
 199 for (var i = 0; i < obj.length; ++i)
 200 stringArray.push(toString(obj[i]));
 201 stringArray.sort();
 202 return '[' + stringArray.join(',\n ') + ']';
 203 } else if (obj.isFile || obj.isDirectory) {
 204 return 'ENTRY {path:' + obj.fullPath + ' name:' + obj.name + (obj.isFile ? ' type:FILE' : ' type:DIRECTORY') + '}';
 205 } else {
 206 return obj;
 207 }
 208 } else
 209 return obj;
 210 }
 211
 212 this.BUILTIN_print = function(args)
 213 {
 214 this.log(toString(args[0]));
 215 this.runNextStatement();
 216 }
 217
 218 this.BUILTIN_reset = function(args)
 219 {
 220 this.log('Reseting the filesystem...');
 221 var shell = this;
 222 removeRecursively(this.fileSystem.root, function() {
 223 shell.runNextStatement();
 224 }, this.bind(this.errorCallback));
 225 }
 226
 227 this.BUILTIN_ASSERT = function(args)
 228 {
 229 var obj = args[0];
 230 if (window.shouldBeNonNull)
 231 shouldBeNonNull('"' + obj + '"');
 232 if (!obj)
 233 this.error('Assertion error:' + obj);
 234 else
 235 this.runNextStatement();
 236 }
 237
 238 this.BUILTIN_ASSERT_GE = function(args)
 239 {
 240 var value1 = (args[0] instanceof Date) ? args[0].getTime() : args[0];
 241 var value2 = (args[1] instanceof Date) ? args[1].getTime() : args[1];
 242 if (window.shouldBeGreaterThanOrEqual)
 243 shouldBeGreaterThanOrEqual('"' + value1 + '"', '"' + value2 + '"');
 244 if (value1 < value2) {
 245 this.error('Assertion error:' + args[0] + ' >= ' + args[1]);
 246 return;
 247 }
 248 this.runNextStatement();
 249 }
 250
 251 this.BUILTIN_ASSERT_EQ = function(args)
 252 {
 253 var value1 = (args[0] instanceof Date) ? args[0].getTime() : args[0];
 254 var value2 = (args[1] instanceof Date) ? args[1].getTime() : args[1];
 255 if (window.shouldBe)
 256 shouldBe.apply(this, [this.argSymbols[1], this.argSymbols[0]]);
 257 if (value1 != value2) {
 258 this.error('Assertion error:' + args[0] + ' == ' + args[1]);
 259 return;
 260 }
 261 this.runNextStatement();
 262 }
 263
 264 // Parser ---------------------------------------------------------------
 265
 266 this.ENTRY_METHOD_RE = /^\s*([A-Za-z_]\w*)\.(getMetadata|moveTo|copyTo|remove|getParent|getFile|getDirectory|readDirectory)\((.*)\)(?:\s+raises?\s*\(?(\d+)\)?|)/;
 267 this.ASSIGNMENT_RE = /^\s*([A-Za-z_]\w*)\s*=\s*(.*)/;
 268
 269 this.parseArgs = function(text) {
 270 this.argSymbols = [];
 271 var args = [];
 272 var shell = this;
 273 var vars = this.vars;
 274 text.replace(/(?:({[^}]*})|(\d+|"[^"]*"|'[^']*')|([a-zA-Z_]\w*)(?:\[(\d+|'\w+'|"\w+")\]|\.(\w+)|))(,|$)\s*/g, function(match, hash, immediate, symbol, field1, field2) {
 275 var field = field1 != undefined ? field1 : field2;
 276 var obj = shell.vars[symbol];
 277 if (symbol && obj == undefined) {
 278 if (symbol == 'null' || symbol == 'undefined') {
 279 obj = null;
 280 } else {
 281 shell.error('Undefined symbol:' + symbol);
 282 return;
 283 }
 284 }
 285 shell.argSymbols.push(
 286 hash ? hash :
 287 immediate ? immediate :
 288 symbol ? 'this.vars["' + symbol + '"]' + (field != undefined ? '["' + field + '"]' : '') : match);
 289 args.push(hash ? eval('o=' + hash)
 290 : immediate ? eval(immediate)
 291 : symbol ? (field != undefined ? obj[field] : obj)
 292 : null);
 293 });
 294 return args;
 295 }
 296
 297 this.runNextStatement = function()
 298 {
 299 if (this.lineCounter < 0 || this.lineCounter >= this.lines.length) {
 300 this.log('Script execution finished.');
 301 this.endTestCallback();
 302 return;
 303 }
 304 this.statement = this.lines[this.lineCounter++];
 305 if (this.statement.search(/^\s*(#.*|)$/) == 0) {
 306 this.runNextStatement();
 307 return;
 308 }
 309 var exp = this.statement;
 310 this.destinationSymbol = null;
 311 this.expectedErrorCode = 0;
 312 var matches = this.statement.match(this.ASSIGNMENT_RE);
 313 if (matches) {
 314 this.destinationSymbol = matches[1];
 315 this.vars[this.destinationSymbol] = null;
 316 exp = matches[2];
 317 }
 318 matches = exp.match(this.ENTRY_METHOD_RE);
 319 if (matches) {
 320 var entry = shell.vars[matches[1]];
 321 var method = matches[2];
 322 if (!entry) {
 323 this.error('No such symbol:' + matches[1]);
 324 return;
 325 }
 326 this.expectedErrorCode = matches[4];
 327 entryMethodsTable[method](this, entry, method, this.parseArgs(matches[3]));
 328 return;
 329 }
 330 matches = exp.match(/^\s*([A-Za-z_]\w+)\((.*)\)/);
 331 if (matches && this['BUILTIN_' + matches[1]]) {
 332 this['BUILTIN_' + matches[1]](this.parseArgs(matches[2]));
 333 return;
 334 }
 335 var values = this.parseArgs(exp);
 336 if (values.length == 1) {
 337 if (this.destinationSymbol)
 338 this.vars[this.destinationSymbol] = values[0];
 339 this.runNextStatement();
 340 return;
 341 }
 342 this.error('Syntax error:' + this.statement);
 343 }
 344
 345 // Misc -----------------------------------------------------------------
 346
 347 this.dumpVars = function()
 348 {
 349 for (var key in this.vars)
 350 this.log('** ' + key + ':' + this.vars[key]);
 351 }
 352
 353 this.error = function(msg)
 354 {
 355 var printError = this.log
 356 if (window.testFailed)
 357 printError = testFailed;
 358 if (this.lineCounter > 0 && this.lineCounter < this.lines.length) {
 359 printError('ERROR:' + msg + ' at line ' + this.lineCounter);
 360 printError(' > ' + this.statement);
 361 } else
 362 printError('ERROR:' + msg);
 363 this.endTestCallback();
 364 }
 365
 366 this.defaultLogFunc = function(msg)
 367 {
 368 var elem = document.getElementById('console');
 369 if (!elem) {
 370 elem = document.createElement('div');
 371 elem.id = 'console';
 372 document.body.appendChild(elem);
 373 }
 374 var span = document.createElement('span');
 375 document.getElementById("console").appendChild(span);
 376 span.innerHTML = msg + '<br />';
 377 }
 378};

LayoutTests/fast/filesystem/restricted-chars-expected.txt

 1Got FileSystem: TestShellFileSystem
 2Reseting the filesystem...
 3PASS this.expectedErrorCode is "13"
 4PASS this.expectedErrorCode is "13"
 5PASS this.expectedErrorCode is "13"
 6PASS this.expectedErrorCode is "13"
 7PASS this.expectedErrorCode is "13"
 8PASS this.expectedErrorCode is "13"
 9PASS this.expectedErrorCode is "13"
 10PASS this.expectedErrorCode is "13"
 11PASS this.expectedErrorCode is "13"
 12PASS this.expectedErrorCode is "13"
 13PASS this.expectedErrorCode is "13"
 14PASS this.expectedErrorCode is "13"
 15PASS this.expectedErrorCode is "13"
 16PASS this.expectedErrorCode is "13"
 17PASS this.expectedErrorCode is "13"
 18PASS this.expectedErrorCode is "13"
 19PASS this.expectedErrorCode is "13"
 20PASS this.expectedErrorCode is "13"
 21PASS this.expectedErrorCode is "13"
 22PASS this.expectedErrorCode is "13"
 23PASS this.expectedErrorCode is "13"
 24PASS this.expectedErrorCode is "13"
 25PASS this.expectedErrorCode is "13"
 26PASS this.expectedErrorCode is "13"
 27PASS Succeeded: ab = ROOT.getFile('ab', {create:true})
 28PASS this.expectedErrorCode is "13"
 29PASS this.expectedErrorCode is "13"
 30PASS this.expectedErrorCode is "13"
 31PASS this.expectedErrorCode is "13"
 32PASS this.expectedErrorCode is "13"
 33PASS this.expectedErrorCode is "13"
 34PASS this.expectedErrorCode is "13"
 35PASS this.expectedErrorCode is "13"
 36PASS this.expectedErrorCode is "13"
 37Script execution finished.
 38PASS successfullyParsed is true
 39
 40TEST COMPLETE
 41

LayoutTests/fast/filesystem/restricted-chars.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="file-system-test-script">
 11
 12 reset()
 13
 14 ROOT.getFile('a\\b') raises 13
 15 ROOT.getFile('a<b') raises 13
 16 ROOT.getFile('a>b') raises 13
 17 ROOT.getFile('a:b') raises 13
 18 ROOT.getFile('a?b') raises 13
 19 ROOT.getFile('a*b') raises 13
 20 ROOT.getFile('a"b') raises 13
 21 ROOT.getFile('a|b') raises 13
 22
 23 ROOT.getFile('\\ab') raises 13
 24 ROOT.getFile('<ab') raises 13
 25 ROOT.getFile('>ab') raises 13
 26 ROOT.getFile(':ab') raises 13
 27 ROOT.getFile('?ab') raises 13
 28 ROOT.getFile('*ab') raises 13
 29 ROOT.getFile('"ab') raises 13
 30 ROOT.getFile('|ab') raises 13
 31
 32 ROOT.getFile('ab\\') raises 13
 33 ROOT.getFile('ab<') raises 13
 34 ROOT.getFile('ab>') raises 13
 35 ROOT.getFile('ab:') raises 13
 36 ROOT.getFile('ab?') raises 13
 37 ROOT.getFile('ab*') raises 13
 38 ROOT.getFile('ab"') raises 13
 39 ROOT.getFile('ab|') raises 13
 40
 41 ab = ROOT.getFile('ab', {create:true})
 42 ab.copyTo(ROOT, 'a\\b') raises 13
 43 ab.copyTo(ROOT, 'a<b') raises 13
 44 ab.copyTo(ROOT, 'a>b') raises 13
 45 ab.copyTo(ROOT, 'a:b') raises 13
 46 ab.copyTo(ROOT, 'a?b') raises 13
 47 ab.copyTo(ROOT, 'a*b') raises 13
 48 ab.copyTo(ROOT, 'a"b') raises 13
 49 ab.copyTo(ROOT, 'a|b') raises 13
 50
 51 # Name should not contain '/'
 52 ab.copyTo(ROOT, 'a/b') raises 13
 53
 54</script>
 55<script src="resources/fs-test-shell-temporary.js"></script>
 56<script src="../js/resources/js-test-post.js"></script>
 57</body>
 58</html>

LayoutTests/fast/filesystem/restricted-names-expected.txt

 1Got FileSystem: TestShellFileSystem
 2Reseting the filesystem...
 3PASS Succeeded: file = ROOT.getFile('aaa', {create:true})
 4PASS Succeeded: dir = ROOT.getFile('bbb', {create:true})
 5PASS this.expectedErrorCode is "13"
 6PASS this.expectedErrorCode is "13"
 7PASS this.expectedErrorCode is "13"
 8PASS this.expectedErrorCode is "13"
 9PASS this.expectedErrorCode is "13"
 10PASS this.expectedErrorCode is "13"
 11PASS this.expectedErrorCode is "13"
 12PASS this.expectedErrorCode is "13"
 13PASS this.expectedErrorCode is "13"
 14PASS this.expectedErrorCode is "13"
 15PASS this.expectedErrorCode is "13"
 16PASS this.expectedErrorCode is "13"
 17PASS this.expectedErrorCode is "13"
 18PASS this.expectedErrorCode is "13"
 19PASS this.expectedErrorCode is "13"
 20PASS this.expectedErrorCode is "13"
 21PASS this.expectedErrorCode is "13"
 22PASS this.expectedErrorCode is "13"
 23PASS this.expectedErrorCode is "13"
 24PASS this.expectedErrorCode is "13"
 25PASS this.expectedErrorCode is "13"
 26PASS this.expectedErrorCode is "13"
 27PASS this.expectedErrorCode is "13"
 28PASS this.expectedErrorCode is "13"
 29PASS this.expectedErrorCode is "13"
 30PASS this.expectedErrorCode is "13"
 31PASS this.expectedErrorCode is "13"
 32PASS this.expectedErrorCode is "13"
 33PASS this.expectedErrorCode is "13"
 34PASS this.expectedErrorCode is "13"
 35PASS this.expectedErrorCode is "13"
 36PASS this.expectedErrorCode is "13"
 37PASS this.expectedErrorCode is "13"
 38PASS this.expectedErrorCode is "13"
 39PASS this.expectedErrorCode is "13"
 40PASS this.expectedErrorCode is "13"
 41Script execution finished.
 42PASS successfullyParsed is true
 43
 44TEST COMPLETE
 45

LayoutTests/fast/filesystem/restricted-names.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6<script src="resources/fs-test-shell.js"></script>
 7</head>
 8<body>
 9<div id="console"></div>
 10<script type="application/file-system-test-shell" id="file-system-test-script">
 11
 12 reset()
 13 file = ROOT.getFile('aaa', {create:true})
 14 dir = ROOT.getFile('bbb', {create:true})
 15
 16 ROOT.getFile('con') raises 13
 17 ROOT.getFile('CON') raises 13
 18 ROOT.getFile('Con') raises 13
 19 ROOT.getFile('cOn.txt') raises 13
 20 ROOT.getDirectory('bbb/coN') raises 13
 21
 22 ROOT.getFile('prn') raises 13
 23 ROOT.getFile('PRN') raises 13
 24 ROOT.getFile('Prn') raises 13
 25 ROOT.getFile('pRn.txt') raises 13
 26 ROOT.getDirectory('bbb/prN') raises 13
 27
 28 ROOT.getFile('aux') raises 13
 29 ROOT.getFile('AUX') raises 13
 30 ROOT.getFile('Aux') raises 13
 31 ROOT.getFile('aUx.txt') raises 13
 32 ROOT.getDirectory('bbb/auX') raises 13
 33
 34 ROOT.getFile('nul') raises 13
 35 ROOT.getFile('NUL') raises 13
 36 ROOT.getFile('Nul') raises 13
 37 ROOT.getFile('nUl.txt') raises 13
 38 ROOT.getDirectory('bbb/nuL') raises 13
 39
 40 ROOT.getFile('com1') raises 13
 41 ROOT.getFile('COM2') raises 13
 42 ROOT.getFile('Com4') raises 13
 43 ROOT.getFile('cOM7.foo') raises 13
 44 ROOT.getDirectory('bbb/coM9') raises 13
 45
 46 ROOT.getFile('lpt1') raises 13
 47 ROOT.getFile('LPT2') raises 13
 48 ROOT.getFile('Lpt4') raises 13
 49 ROOT.getFile('lPT7.foo') raises 13
 50 ROOT.getDirectory('bbb/lpT9') raises 13
 51
 52 # Names should not end with period or whitespace.
 53 ROOT.getFile('foo ') raises 13
 54 ROOT.getFile('foo\n') raises 13
 55 ROOT.getFile('foo.') raises 13
 56 file.copyTo(dir, 'foo ') raises 13
 57 file.copyTo(dir, 'foo\t') raises 13
 58 file.copyTo(dir, 'foo.') raises 13
 59
 60</script>
 61<script src="resources/fs-test-shell-temporary.js"></script>
 62<script src="../js/resources/js-test-post.js"></script>
 63</body>
 64</html>

LayoutTests/fast/filesystem/script-tests/parallel-operations.js

 1description("Test making multiple FileSystem operations in parallel.");
 2
 3var fileSystem = null;
 4
 5var a;
 6var b;
 7var c;
 8
 9function endTest() {
 10 removeRecursively(fileSystem.root);
 11 finishJSTest();
 12}
 13
 14function errorCallback(error) {
 15 debug("Got error: " + error.code);
 16 endTest();
 17}
 18
 19var paths = [];
 20var dirs = 0;
 21var reader = null;
 22
 23function entriesCallback(entries) {
 24 for (var i = 0; i < entries.length; ++i) {
 25 paths.push(entries[i].fullPath);
 26 if (entries[i].isDirectory)
 27 dirs++;
 28 }
 29 if (!entries.length) {
 30 reader.readEntries(entriesCallback, errorCallback);
 31 } else {
 32 paths.sort();
 33 shouldBe('"' + paths.join(',') + '"', '"/a,/b2,/c,/d,/e"');
 34 endTest();
 35 }
 36}
 37
 38function verify() {
 39 debug("Verifying the FileSystem status.");
 40 reader = fileSystem.root.createReader();
 41 reader.readEntries(entriesCallback, errorCallback);
 42}
 43
 44function parallelTest2() {
 45 debug("Starting parallel test stage 2.");
 46
 47 var helper = new JoinHelper();
 48 var done = function() { helper.done(); };
 49
 50 helper.run(function() { a.copyTo(b, 'tmp', done, errorCallback); });
 51 helper.run(function() { a.getMetadata(done, errorCallback); });
 52 helper.run(function() { b.getParent(done, errorCallback); });
 53 helper.run(function() { b.moveTo(fileSystem.root, 'b2', done, errorCallback); });
 54 helper.run(function() { c.copyTo(fileSystem.root, 'd', done, errorCallback); });
 55 helper.run(function() { fileSystem.root.getFile('e', {create:true}, done, errorCallback); });
 56
 57 helper.join(verify);
 58}
 59
 60function parallelTest1() {
 61 debug("Starting parallel test stage 1.");
 62
 63 var helper = new JoinHelper();
 64 var root = fileSystem.root;
 65
 66 helper.run(function() { root.getFile('a', {create:true}, function(entry) {
 67 a = entry;
 68 helper.done();
 69 }, errorCallback); });
 70
 71 helper.run(function() { root.getDirectory('b', {create:true}, function(entry) {
 72 b = entry;
 73 helper.done();
 74 }, errorCallback); });
 75
 76 helper.run(function() { root.getDirectory('c', {create:true}, function(entry) {
 77 c = entry;
 78 helper.done();
 79 }, errorCallback); });
 80
 81 helper.join(parallelTest2);
 82}
 83
 84if (window.requestFileSystem) {
 85 window.jsTestIsAsync = true;
 86 var helper = new JoinHelper();
 87 helper.run(function() {
 88 requestFileSystem.apply(this, [window.TEMPORARY, 100, function(fs) {
 89 debug("Got FileSystem:" + fs.name);
 90 fileSystem = fs;
 91 removeRecursively(fileSystem.root, function(){ helper.done(); }, errorCallback);
 92 }, errorCallback]); });
 93 debug("requested FileSystem.");
 94 helper.join(parallelTest1);
 95} else
 96 debug("This test requires FileSystem API support.");
 97
 98window.successfullyParsed = true;

LayoutTests/fast/filesystem/script-tests/simple-persistent.js

 1description("Persistent FileSystem simple test.");
 2var fileSystem = null;
 3
 4function errorCallback(fileSystem) {
 5 debug("Error occured during requesting Persistent FileSystem:" + fileSystem.name);
 6
 7 if (window.layoutTestController)
 8 layoutTestController.notifyDone();
 9}
 10
 11function successCallback(fs) {
 12 fileSystem = fs;
 13 debug("Successfully obtained Persistent FileSystem:" + fileSystem.name);
 14 shouldBeTrue("fileSystem.name.length > 0");
 15 shouldBe("fileSystem.root.fullPath", '"/"');
 16
 17 if (window.layoutTestController)
 18 layoutTestController.notifyDone();
 19}
 20
 21if (window.requestFileSystem) {
 22 if (window.layoutTestController)
 23 layoutTestController.waitUntilDone();
 24
 25 requestFileSystem(window.PERSISTENT, 100, successCallback, errorCallback);
 26} else
 27 debug("This test requires FileSystem API support.");
 28
 29window.successfullyParsed = true;

LayoutTests/fast/filesystem/script-tests/simple-temporary.js

 1description("Temporary FileSystem simple test.");
 2var fileSystem = null;
 3
 4function errorCallback(fileSystem) {
 5 debug("Error occured during requesting Temporary FileSystem:" + fileSystem.name);
 6
 7 if (window.layoutTestController)
 8 layoutTestController.notifyDone();
 9}
 10
 11function successCallback(fs) {
 12 fileSystem = fs;
 13 debug("Successfully obtained Temporary FileSystem:" + fileSystem.name);
 14 shouldBeTrue("fileSystem.name.length > 0");
 15 shouldBe("fileSystem.root.fullPath", '"/"');
 16
 17 if (window.layoutTestController)
 18 layoutTestController.notifyDone();
 19}
 20
 21if (window.requestFileSystem) {
 22 if (window.layoutTestController)
 23 layoutTestController.waitUntilDone();
 24
 25 requestFileSystem(window.TEMPORARY, 100, successCallback, errorCallback);
 26} else
 27 debug("This test requires FileSystem API support.");
 28
 29window.successfullyParsed = true;

LayoutTests/fast/filesystem/simple-persistent-expected.txt

 1Persistent FileSystem simple test.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Successfully obtained Persistent FileSystem:TestShellFileSystem
 7PASS fileSystem.name.length > 0 is true
 8PASS fileSystem.root.fullPath is "/"
 9PASS successfullyParsed is true
 10
 11TEST COMPLETE
 12

LayoutTests/fast/filesystem/simple-persistent.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6</head>
 7<body>
 8<p id="description"></p>
 9<div id="console"></div>
 10<script src="script-tests/simple-persistent.js"></script>
 11<script src="../js/resources/js-test-post.js"></script>
 12</body>
 13</html>

LayoutTests/fast/filesystem/simple-temporary-expected.txt

 1Temporary FileSystem simple test.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6Successfully obtained Temporary FileSystem:TestShellFileSystem
 7PASS fileSystem.name.length > 0 is true
 8PASS fileSystem.root.fullPath is "/"
 9PASS successfullyParsed is true
 10
 11TEST COMPLETE
 12

LayoutTests/fast/filesystem/simple-temporary.html

 1<html>
 2<head>
 3<link rel="stylesheet" href="../js/resources/js-test-style.css">
 4<script src="../js/resources/js-test-pre.js"></script>
 5<script src="resources/fs-test-util.js"></script>
 6</head>
 7<body>
 8<p id="description"></p>
 9<div id="console"></div>
 10<script src="script-tests/simple-temporary.js"></script>
 11<script src="../js/resources/js-test-post.js"></script>
 12</body>
 13</html>