OLD | NEW |
---|---|
1 // js-test now supports lazily printing test results which dumps all test | 1 // js-test now supports lazily printing test results which dumps all test |
2 // results once at the end of the test instead of building them up. To enable | 2 // results once at the end of the test instead of building them up. To enable |
3 // this option, call setPrintTestResultsLazily() before running any tests. | 3 // this option, call setPrintTestResultsLazily() before running any tests. |
4 var _lazyTestResults; // Set by setPrintTestResultsLazily(). | 4 var _lazyTestResults; // Set by setPrintTestResultsLazily(). |
5 | 5 |
6 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results | 6 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex t + pixel results |
7 if (self.testRunner) { | 7 if (self.testRunner) { |
8 if (self.enablePixelTesting) | 8 if (self.enablePixelTesting) |
9 testRunner.dumpAsTextWithPixelResults(); | 9 testRunner.dumpAsTextWithPixelResults(); |
10 else | 10 else |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 | 284 |
285 function shouldBecomeEqual(_a, _b, _completionHandler, _timeout) | 285 function shouldBecomeEqual(_a, _b, _completionHandler, _timeout) |
286 { | 286 { |
287 if (typeof _a != "string" || typeof _b != "string") | 287 if (typeof _a != "string" || typeof _b != "string") |
288 debug("WARN: shouldBecomeEqual() expects string arguments"); | 288 debug("WARN: shouldBecomeEqual() expects string arguments"); |
289 | 289 |
290 if (_timeout === undefined) | 290 if (_timeout === undefined) |
291 _timeout = 500; | 291 _timeout = 500; |
292 | 292 |
293 var _bv; | 293 var _bv; |
294 var _condition = function() { | 294 function _condition() { |
295 var _exception; | 295 var _exception; |
296 var _av; | 296 var _av; |
297 try { | 297 try { |
298 _av = eval(_a); | 298 _av = eval(_a); |
299 } catch (e) { | 299 } catch (e) { |
300 _exception = e; | 300 _exception = e; |
301 } | 301 } |
302 _bv = eval(_b); | 302 _bv = eval(_b); |
303 if (_exception) | 303 if (_exception) |
304 testFailed(_a + " should become " + _bv + ". Threw exception " + _exceptio n); | 304 testFailed(_a + " should become " + _bv + ". Threw exception " + _exceptio n); |
305 if (isResultCorrect(_av, _bv)) { | 305 if (isResultCorrect(_av, _bv)) { |
306 testPassed(_a + " became " + _b); | 306 testPassed(_a + " became " + _b); |
307 return true; | 307 return true; |
308 } | 308 } |
309 return false; | 309 return false; |
310 }; | 310 }; |
311 var _failureTime = Date.now() + _timeout; | 311 var _failureTime = Date.now() + _timeout; |
312 var _failureHandler = function () { | 312 var _failureHandler = function () { |
313 testFailed(_a + " failed to change to " + _bv + " in " + (_timeout / 1000) + " seconds."); | 313 testFailed(_a + " failed to change to " + _bv + " in " + (_timeout / 1000) + " seconds."); |
314 _completionHandler(); | 314 _completionHandler(); |
315 }; | 315 }; |
316 _waitForCondition(_condition, _failureTime, _completionHandler, _failureHandle r); | 316 setTimeout(_waitForCondition, 5, _condition, _failureTime, _completionHandler, _failureHandler); |
please use gerrit instead
2015/02/10 22:59:20
This is not necessary, because _waitForCondition()
grzegorz
2015/02/11 10:54:23
Not really, assuming existing implementation, befo
| |
317 } | 317 } |
318 | 318 |
319 function shouldBecomeEqualToString(value, reference, completionHandler, timeout) | 319 function shouldBecomeEqualToString(value, reference, completionHandler, timeout) |
320 { | 320 { |
321 if (typeof value !== "string" || typeof reference !== "string") | 321 if (typeof value !== "string" || typeof reference !== "string") |
322 debug("WARN: shouldBecomeEqualToString() expects string arguments"); | 322 debug("WARN: shouldBecomeEqualToString() expects string arguments"); |
323 var unevaledString = JSON.stringify(reference); | 323 var unevaledString = JSON.stringify(reference); |
324 shouldBecomeEqual(value, unevaledString, completionHandler, timeout); | 324 shouldBecomeEqual(value, unevaledString, completionHandler, timeout); |
325 } | 325 } |
326 | 326 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 } | 404 } |
405 | 405 |
406 function shouldBecomeDifferent(_a, _b, _completionHandler, _timeout) | 406 function shouldBecomeDifferent(_a, _b, _completionHandler, _timeout) |
407 { | 407 { |
408 if (typeof _a != "string" || typeof _b != "string") | 408 if (typeof _a != "string" || typeof _b != "string") |
409 debug("WARN: shouldBecomeDifferent() expects string arguments"); | 409 debug("WARN: shouldBecomeDifferent() expects string arguments"); |
410 if (_timeout === undefined) | 410 if (_timeout === undefined) |
411 _timeout = 500; | 411 _timeout = 500; |
412 | 412 |
413 var _bv; | 413 var _bv; |
414 var _condition = function() { | 414 function _condition() { |
415 var _exception; | 415 var _exception; |
416 var _av; | 416 var _av; |
417 try { | 417 try { |
418 _av = eval(_a); | 418 _av = eval(_a); |
419 } catch (e) { | 419 } catch (e) { |
420 _exception = e; | 420 _exception = e; |
421 } | 421 } |
422 _bv = eval(_b); | 422 _bv = eval(_b); |
423 if (_exception) | 423 if (_exception) |
424 testFailed(_a + " should became not equal to " + _bv + ". Threw exception " + _exception); | 424 testFailed(_a + " should became not equal to " + _bv + ". Threw exception " + _exception); |
425 if (!isResultCorrect(_av, _bv)) { | 425 if (!isResultCorrect(_av, _bv)) { |
426 testPassed(_a + " became different from " + _b); | 426 testPassed(_a + " became different from " + _b); |
427 return true; | 427 return true; |
428 } | 428 } |
429 return false; | 429 return false; |
430 }; | 430 }; |
431 var _failureTime = Date.now() + _timeout; | 431 var _failureTime = Date.now() + _timeout; |
432 var _failureHandler = function () { | 432 var _failureHandler = function () { |
433 testFailed(_a + " did not become different from " + _bv + " in " + (_timeout / 1000) + " seconds."); | 433 testFailed(_a + " did not become different from " + _bv + " in " + (_timeout / 1000) + " seconds."); |
434 _completionHandler(); | 434 _completionHandler(); |
435 }; | 435 }; |
436 _waitForCondition(_condition, _failureTime, _completionHandler, _failureHandle r); | 436 setTimeout(_waitForCondition, 5, _condition, _failureTime, _completionHandler, _failureHandler); |
437 } | 437 } |
438 | 438 |
439 function shouldBeTrue(a, quiet) { shouldBe(a, "true", quiet); } | 439 function shouldBeTrue(a, quiet) { shouldBe(a, "true", quiet); } |
440 function shouldBeTrueQuiet(a) { shouldBe(a, "true", true); } | 440 function shouldBeTrueQuiet(a) { shouldBe(a, "true", true); } |
441 function shouldBeFalse(a, quiet) { shouldBe(a, "false", quiet); } | 441 function shouldBeFalse(a, quiet) { shouldBe(a, "false", quiet); } |
442 function shouldBeNaN(a, quiet) { shouldBe(a, "NaN", quiet); } | 442 function shouldBeNaN(a, quiet) { shouldBe(a, "NaN", quiet); } |
443 function shouldBeNull(a, quiet) { shouldBe(a, "null", quiet); } | 443 function shouldBeNull(a, quiet) { shouldBe(a, "null", quiet); } |
444 function shouldBeZero(a, quiet) { shouldBe(a, "0", quiet); } | 444 function shouldBeZero(a, quiet) { shouldBe(a, "0", quiet); } |
445 | 445 |
446 function shouldBeEqualToString(a, b) | 446 function shouldBeEqualToString(a, b) |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
871 testPassed = function(msg) { | 871 testPassed = function(msg) { |
872 workerPort.postMessage('PASS:' + msg); | 872 workerPort.postMessage('PASS:' + msg); |
873 }; | 873 }; |
874 finishJSTest = function() { | 874 finishJSTest = function() { |
875 workerPort.postMessage('DONE:'); | 875 workerPort.postMessage('DONE:'); |
876 }; | 876 }; |
877 debug = function(msg) { | 877 debug = function(msg) { |
878 workerPort.postMessage(msg); | 878 workerPort.postMessage(msg); |
879 }; | 879 }; |
880 } | 880 } |
OLD | NEW |