Changeset 156678 in webkit
- Timestamp:
- Sep 30, 2013, 1:47:43 PM (11 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r156664 r156678 1 2013-09-30 Alexey Proskuryakov <ap@apple.com> 2 3 Remove timeout from shouldBecome* functions in js-test-pre 4 https://bugs.webkit.org/show_bug.cgi?id=122121 5 6 Reviewed by Ryosuke Niwa. 7 8 Removed timeout. A 0.5 sec timeout never makes sense, and if something is stuck, 9 a test should just time out normally. 10 11 * resources/js-test-pre.js: 12 (_waitForCondition): 13 (shouldBecomeEqual): 14 (shouldBecomeEqualToString): 15 (shouldBecomeDifferent): 16 1 17 2013-09-30 Jer Noble <jer.noble@apple.com> 2 18 -
trunk/LayoutTests/resources/js-test-pre.js
r155624 r156678 265 265 } 266 266 267 // Execute condition every 5 milliseconds until it succeed or failureTime is reached. 268 // completionHandler is executed on success, failureHandler is executed on timeout. 269 function _waitForCondition(condition, failureTime, completionHandler, failureHandler) 270 { 271 if (condition()) { 267 // Execute condition every 5 milliseconds until it succeeds. 268 function _waitForCondition(condition, completionHandler) 269 { 270 if (condition()) 272 271 completionHandler(); 273 } else if (Date.now() > failureTime) { 274 failureHandler(); 275 } else { 276 setTimeout(_waitForCondition, 5, condition, failureTime, completionHandler, failureHandler); 277 } 278 } 279 280 function shouldBecomeEqual(_a, _b, completionHandler, timeout) 272 else 273 setTimeout(_waitForCondition, 5, condition, completionHandler); 274 } 275 276 function shouldBecomeEqual(_a, _b, completionHandler) 281 277 { 282 278 if (typeof _a != "string" || typeof _b != "string") 283 279 debug("WARN: shouldBecomeEqual() expects string arguments"); 284 285 if (timeout === undefined)286 timeout = 500;287 280 288 281 var condition = function() { … … 303 296 return false; 304 297 }; 305 var failureTime = Date.now() + timeout; 306 var failureHandler = function () { 307 testFailed(_a + " failed to change to " + _b + " in " + (timeout / 1000) + " seconds."); 308 completionHandler(); 309 }; 310 _waitForCondition(condition, failureTime, completionHandler, failureHandler); 311 } 312 313 function shouldBecomeEqualToString(value, reference, completionHandler, timeout) 298 _waitForCondition(condition, completionHandler); 299 } 300 301 function shouldBecomeEqualToString(value, reference, completionHandler) 314 302 { 315 303 if (typeof value !== "string" || typeof reference !== "string") 316 304 debug("WARN: shouldBecomeEqualToString() expects string arguments"); 317 305 var unevaledString = JSON.stringify(reference); 318 shouldBecomeEqual(value, unevaledString, completionHandler , timeout);306 shouldBecomeEqual(value, unevaledString, completionHandler); 319 307 } 320 308 … … 398 386 } 399 387 400 function shouldBecomeDifferent(_a, _b, completionHandler , timeout)388 function shouldBecomeDifferent(_a, _b, completionHandler) 401 389 { 402 390 if (typeof _a != "string" || typeof _b != "string") 403 391 debug("WARN: shouldBecomeDifferent() expects string arguments"); 404 if (timeout === undefined)405 timeout = 500;406 392 407 393 var condition = function() { … … 422 408 return false; 423 409 }; 424 var failureTime = Date.now() + timeout; 425 var failureHandler = function () { 426 testFailed(_a + " did not become different from " + _b + " in " + (timeout / 1000) + " seconds."); 427 completionHandler(); 428 }; 429 _waitForCondition(condition, failureTime, completionHandler, failureHandler); 410 _waitForCondition(condition, completionHandler); 430 411 } 431 412
Note:
See TracChangeset
for help on using the changeset viewer.