Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / filesystem / resources / op-copy.js
blob7e4b36495e11fc968fe683de58872b2d9922338a
1 var testCases = [
3 name: 'CopyFileSimple',
4 precondition: [
5 {fullPath:'/a', isDirectory:true},
6 {fullPath:'/a/b'}
7 ],
8 tests: [
9 function(helper) { helper.copy('/a/b', '/a', 'c'); }
11 postcondition: [
12 {fullPath:'/a', isDirectory:true},
13 {fullPath:'/a/b'},
14 {fullPath:'/a/c'}
18 name: 'CopyDirectorySimple',
19 precondition: [
20 {fullPath:'/a', isDirectory:true},
21 {fullPath:'/a/b', isDirectory:true}
23 tests: [
24 function(helper) { helper.copy('/a/b', '/a', 'c'); },
26 postcondition: [
27 {fullPath:'/a', isDirectory:true},
28 {fullPath:'/a/b', isDirectory:true},
29 {fullPath:'/a/c', isDirectory:true}
33 name: 'CopyFileToDifferentDirectory',
34 precondition: [
35 {fullPath:'/a', isDirectory:true},
36 {fullPath:'/a/b'},
37 {fullPath:'/c', isDirectory:true}
39 tests: [
40 function(helper) { helper.copy('/a/b', '/c', 'd'); },
42 postcondition: [
43 {fullPath:'/a', isDirectory:true},
44 {fullPath:'/a/b'},
45 {fullPath:'/c/d'}
49 name: 'CopyFileWithEmptyName',
50 precondition: [
51 {fullPath:'/a', isDirectory:true},
52 {fullPath:'/a/b'},
53 {fullPath:'/c', isDirectory:true},
55 tests: [
56 function(helper) { helper.copy('/a/b', '/c', null); },
58 postcondition: [
59 {fullPath:'/a', isDirectory:true},
60 {fullPath:'/a/b'},
61 {fullPath:'/c/b'}
65 name: 'CopyFileWithEmptyNameToSameDirectory',
66 precondition: [
67 {fullPath:'/a', isDirectory:true},
68 {fullPath:'/a/b'},
70 tests: [
71 function(helper) { helper.copy('/a/b', '/a', null, 'InvalidModificationError'); },
73 postcondition: [
74 {fullPath:'/a', isDirectory:true},
75 {fullPath:'/a/b'},
79 name: 'CopyFileWithSameName',
80 precondition: [
81 {fullPath:'/a', isDirectory:true},
82 {fullPath:'/a/b'},
84 tests: [
85 function(helper) { helper.copy('/a/b', '/a', 'b', 'InvalidModificationError'); },
87 postcondition: [
88 {fullPath:'/a', isDirectory:true},
89 {fullPath:'/a/b'},
93 name: 'CopyForNonExistentEntry',
94 precondition: [
95 {fullPath:'/a', isDirectory:true},
96 {fullPath:'/a/b'},
97 {fullPath:'/c', isDirectory:true},
99 tests: [
100 function(helper) { helper.remove('/a/b'); },
101 function(helper) { helper.copy('/a/b', '/c', 'b', 'NotFoundError'); },
103 postcondition: [
104 {fullPath:'/a', isDirectory:true},
105 {fullPath:'/c', isDirectory:true},
109 name: 'CopyEntryToNonExistentDirectory',
110 precondition: [
111 {fullPath:'/a', isDirectory:true},
112 {fullPath:'/a/b'},
113 {fullPath:'/c', isDirectory:true},
115 tests: [
116 function(helper) { helper.remove('/c'); },
117 function(helper) { helper.copy('/a/b', '/c', 'b', 'NotFoundError'); },
119 postcondition: [
120 {fullPath:'/a', isDirectory:true},
121 {fullPath:'/a/b'},
125 name: 'CopyEntryToItsChild',
126 precondition: [
127 {fullPath:'/a', isDirectory:true},
128 {fullPath:'/a/b', isDirectory:true},
129 {fullPath:'/a/b/c', isDirectory:true},
131 tests: [
132 function(helper) { helper.copy('/a', '/a/b', 'd', 'InvalidModificationError'); },
133 function(helper) { helper.copy('/a/b', '/a/b/c', 'd', 'InvalidModificationError'); },
135 postcondition: [
136 {fullPath:'/a', isDirectory:true},
137 {fullPath:'/a/b', isDirectory:true},
138 {fullPath:'/a/b/c', isDirectory:true},
142 name: 'CopyRecursive',
143 precondition: [
144 {fullPath:'/a', isDirectory:true},
145 {fullPath:'/a/b', isDirectory:true},
146 {fullPath:'/a/b/c'},
147 {fullPath:'/a/b/d'},
148 {fullPath:'/b', isDirectory:true},
150 tests: [
151 function(helper) { helper.copy('/a', '/b', 'a'); },
153 postcondition: [
154 {fullPath:'/a', isDirectory:true},
155 {fullPath:'/a/b', isDirectory:true},
156 {fullPath:'/a/b/c'},
157 {fullPath:'/a/b/d'},
158 {fullPath:'/b/a', isDirectory:true},
159 {fullPath:'/b/a/b', isDirectory:true},
160 {fullPath:'/b/a/b/c'},
161 {fullPath:'/b/a/b/d'},
165 name: "OverwritingCopyFileToFile",
166 precondition: [
167 {fullPath:"/a"},
168 {fullPath:"/b"},
170 tests: [
171 function(helper) {helper.copy("/a","/","b");}
173 postcondition: [
174 {fullPath:"/a"},
175 {fullPath:"/b"},
179 name: "OverwritingCopyDirectoryToEmptyDirectory",
180 precondition: [
181 {fullPath:"/a", isDirectory:true},
182 {fullPath:"/a/b"},
183 {fullPath:"/c", isDirectory:true},
185 tests: [
186 function(helper) {helper.copy("/a","/","c");}
188 postcondition: [
189 {fullPath:"/a", isDirectory:true},
190 {fullPath:"/a/b"},
191 {fullPath:"/c", isDirectory:true},
192 {fullPath:"/c/b"},
196 name: "OverwritingCopyFileToDirectory",
197 precondition: [
198 {fullPath:"/a"},
199 {fullPath:"/b", isDirectory: true},
201 tests: [
202 function(helper) {helper.copy("/a","/","b",'InvalidModificationError');}
204 postcondition: [
205 {fullPath:"/a"},
206 {fullPath:"/b", isDirectory: true},
210 name: "OverwritingCopyDirectoryToFile",
211 precondition: [
212 {fullPath:"/a", isDirectory: true},
213 {fullPath:"/b"},
215 tests: [
216 function(helper) {helper.copy("/a","/","b",'InvalidModificationError');}
218 postcondition: [
219 {fullPath:"/a", isDirectory: true},
220 {fullPath:"/b"},
224 name: "OverwritingCopyFileToNonemptyDirectory",
225 precondition: [
226 {fullPath:"/a"},
227 {fullPath:"/b", isDirectory: true},
228 {fullPath:"/b/c"},
230 tests: [
231 function(helper) {helper.copy("/a","/","b",'InvalidModificationError');}
233 postcondition: [
234 {fullPath:"/a"},
235 {fullPath:"/b", isDirectory: true},
236 {fullPath:"/b/c"},
240 name: "OverwritingCopyDirectoryToNonemptyDirectory",
241 precondition: [
242 {fullPath:"/a", isDirectory: true},
243 {fullPath:"/a/b"},
244 {fullPath:"/c", isDirectory: true},
245 {fullPath:"/c/d"},
247 tests: [
248 function(helper) {helper.copy("/a","/","c",'InvalidModificationError');}
250 postcondition: [
251 {fullPath:"/a", isDirectory: true},
252 {fullPath:"/a/b"},
253 {fullPath:"/c", isDirectory: true},
254 {fullPath:"/c/d"},