Changeset 75232 in webkit
- Timestamp:
- Jan 6, 2011 11:07:32 PM (13 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r75231 r75232 1 2011-01-06 Kinuko Yasuda <kinuko@chromium.org> 2 3 Reviewed by David Levin. 4 5 Add layout tests for Entry.getMetadata (FileSystem API) 6 https://bugs.webkit.org/show_bug.cgi?id=47311 7 8 * fast/filesystem/op-get-metadata-expected.txt: Added. 9 * fast/filesystem/op-get-metadata.html: Added. 10 * fast/filesystem/resources/op-get-metadata.js: Added. 11 * fast/filesystem/resources/op-tests-helper.js: Updated getMetadata 12 implementation. 13 1 14 2011-01-06 Mihai Parparita <mihaip@chromium.org> 2 15 -
trunk/LayoutTests/fast/filesystem/resources/op-tests-helper.js
r69485 r75232 142 142 this.readEntries = []; 143 143 144 this.getSymbolString = function(symbol) 145 { 146 return 'this.environment["' + symbol + '"]'; 147 }; 148 144 149 this.testSuccessCallback = function() 145 150 { … … 147 152 testPassed('Succeeded: ' + this.stage); 148 153 this.runNextTest(); 149 } else { 150 testFailed('Unexpectedly succeeded while ' + this.stage); 151 this.errorCallback(); 152 } 154 } else 155 testFailed('Unexpectedly succeeded while ' + this.stage); 153 156 }; 154 157 … … 163 166 shouldBe.apply(this, ['this.environment[this.entry.fullPath].isDirectory + ""', '"' + entry.isDirectory + '"']); 164 167 this.runNextTest(); 165 } else { 166 testFailed('Unexpectedly succeeded while ' + this.stage); 167 this.errorCallback(error); 168 } 168 } else 169 testFailed('Unexpectedly succeeded while ' + this.stage); 169 170 }; 170 171 … … 175 176 this.environment[entry.fullPath] = entry; 176 177 this.runNextTest(); 177 } else { 178 testFailed('Unexpectedly succeeded while ' + this.stage); 179 this.errorCallback(); 180 } 178 } else 179 testFailed('Unexpectedly succeeded while ' + this.stage); 181 180 }; 182 181 … … 187 186 debug('Parent entry: ' + toString(entry)); 188 187 this.runNextTest(); 189 } else { 190 testFailed('Unexpectedly succeeded while ' + this.stage); 191 this.errorCallback(); 192 } 188 } else 189 testFailed('Unexpectedly succeeded while ' + this.stage); 193 190 }; 194 191 195 192 this.testReadEntriesSuccessCallback = function(entries) 196 193 { 197 if (this.expectedErrorCode) { 198 testFailed('Unexpectedly succeeded while ' + this.stage); 199 this.errorCallback(error); 200 return; 201 } 194 if (this.expectedErrorCode) 195 testFailed('Unexpectedly succeeded while ' + this.stage); 202 196 203 197 for (var i = 0; i < entries.length; ++i) … … 214 208 }; 215 209 210 this.testMetadataSuccessCallback = function(metadata, entry) 211 { 212 if (!this.expectedErrorCode) { 213 testPassed('Succeeded: ' + this.stage); 214 var symbol = entry + '.modificationTime'; 215 this.environment[symbol] = metadata.modificationTime; 216 217 var entryMetadataString = this.getSymbolString(symbol); 218 if (entry != '/') 219 shouldBeGreaterThanOrEqual.apply(this, [entryMetadataString, 'this.roundedStartDate']); 220 shouldBeGreaterThanOrEqual.apply(this, ['new Date()', entryMetadataString]); 221 this.runNextTest(); 222 } else 223 testFailed('Unexpectedly succeeded while ' + this.stage); 224 }; 225 216 226 this.testErrorCallback = function(error) 217 227 { … … 254 264 this.expectedErrorCode = expectedErrorCode; 255 265 this.stage = '"' + entry + '".getMetadata()'; 256 this.environment[entry].getMetadata(bindCallback(this, this.test SuccessCallback), bindCallback(this, this.testErrorCallback));266 this.environment[entry].getMetadata(bindCallback(this, this.testMetadataSuccessCallback, entry), bindCallback(this, this.testErrorCallback)); 257 267 }; 258 268 … … 294 304 }; 295 305 306 this.shouldBe = function(symbol1, symbol2) 307 { 308 shouldBe.apply(this, [this.getSymbolString(symbol1), this.getSymbolString(symbol2)]); 309 this.runNextTest(); 310 }; 311 312 this.shouldBeGreaterThanOrEqual = function(symbol1, symbol2) 313 { 314 shouldBeGreaterThanOrEqual.apply(this, [this.getSymbolString(symbol1), this.getSymbolString(symbol2)]); 315 this.runNextTest(); 316 }; 317 296 318 //--------------------------------------------------------------- 297 319 this.start = function() … … 299 321 this.expectedErrorCode = ''; 300 322 this.stage = 'resetting filesystem'; 323 // Record rounded start date (current time minus 999 msec) here for the comparison. Entry.getMetadata() may return the last mod time in seconds accuracy while new Date() is milliseconds accuracy. 324 this.roundedStartDate = new Date((new Date()).getTime() - 999); 301 325 removeAllInDirectory(this.fileSystem.root, bindCallback(this, this.setUp), bindCallback(this, this.testErrorCallback)); 302 326 };
Note: See TracChangeset
for help on using the changeset viewer.