| OLD | NEW |
| 1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results | 1 // svg/dynamic-updates tests set enablePixelTesting=true, as we want to dump tex
t + pixel results |
| 2 if (self.testRunner) { | 2 if (self.testRunner) { |
| 3 if (self.enablePixelTesting) | 3 if (self.enablePixelTesting) |
| 4 testRunner.dumpAsTextWithPixelResults(); | 4 testRunner.dumpAsTextWithPixelResults(); |
| 5 else | 5 else |
| 6 testRunner.dumpAsText(); | 6 testRunner.dumpAsText(); |
| 7 } | 7 } |
| 8 | 8 |
| 9 var description, debug, successfullyParsed, errorMessage; | 9 var description, debug, successfullyParsed, errorMessage; |
| 10 | 10 |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 } | 222 } |
| 223 | 223 |
| 224 function shouldBecomeEqual(_a, _b, completionHandler, timeout) | 224 function shouldBecomeEqual(_a, _b, completionHandler, timeout) |
| 225 { | 225 { |
| 226 if (typeof _a != "string" || typeof _b != "string") | 226 if (typeof _a != "string" || typeof _b != "string") |
| 227 debug("WARN: shouldBecomeEqual() expects string arguments"); | 227 debug("WARN: shouldBecomeEqual() expects string arguments"); |
| 228 | 228 |
| 229 if (timeout === undefined) | 229 if (timeout === undefined) |
| 230 timeout = 500; | 230 timeout = 500; |
| 231 | 231 |
| 232 var _bv; |
| 232 var condition = function() { | 233 var condition = function() { |
| 233 var exception; | 234 var exception; |
| 234 var _av; | 235 var _av; |
| 235 try { | 236 try { |
| 236 _av = eval(_a); | 237 _av = eval(_a); |
| 237 } catch (e) { | 238 } catch (e) { |
| 238 exception = e; | 239 exception = e; |
| 239 } | 240 } |
| 240 var _bv = eval(_b); | 241 _bv = eval(_b); |
| 241 if (exception) | 242 if (exception) |
| 242 testFailed(_a + " should become " + _bv + ". Threw exception " + exception
); | 243 testFailed(_a + " should become " + _bv + ". Threw exception " + exception
); |
| 243 if (isResultCorrect(_av, _bv)) { | 244 if (isResultCorrect(_av, _bv)) { |
| 244 testPassed(_a + " became " + _b); | 245 testPassed(_a + " became " + _b); |
| 245 return true; | 246 return true; |
| 246 } | 247 } |
| 247 return false; | 248 return false; |
| 248 }; | 249 }; |
| 249 var failureTime = Date.now() + timeout; | 250 var failureTime = Date.now() + timeout; |
| 250 var failureHandler = function () { | 251 var failureHandler = function () { |
| 251 testFailed(_a + " failed to change to " + _b + " in " + (timeout / 1000) + "
seconds."); | 252 testFailed(_a + " failed to change to " + _bv + " in " + (timeout / 1000) +
" seconds."); |
| 252 completionHandler(); | 253 completionHandler(); |
| 253 }; | 254 }; |
| 254 _waitForCondition(condition, failureTime, completionHandler, failureHandler); | 255 _waitForCondition(condition, failureTime, completionHandler, failureHandler); |
| 255 } | 256 } |
| 256 | 257 |
| 257 function shouldBecomeEqualToString(value, reference, completionHandler, timeout) | 258 function shouldBecomeEqualToString(value, reference, completionHandler, timeout) |
| 258 { | 259 { |
| 259 if (typeof value !== "string" || typeof reference !== "string") | 260 if (typeof value !== "string" || typeof reference !== "string") |
| 260 debug("WARN: shouldBecomeEqualToString() expects string arguments"); | 261 debug("WARN: shouldBecomeEqualToString() expects string arguments"); |
| 261 var unevaledString = JSON.stringify(reference); | 262 var unevaledString = JSON.stringify(reference); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 testFailed(_a + " should not be " + _bv + "."); | 342 testFailed(_a + " should not be " + _bv + "."); |
| 342 } | 343 } |
| 343 | 344 |
| 344 function shouldBecomeDifferent(_a, _b, completionHandler, timeout) | 345 function shouldBecomeDifferent(_a, _b, completionHandler, timeout) |
| 345 { | 346 { |
| 346 if (typeof _a != "string" || typeof _b != "string") | 347 if (typeof _a != "string" || typeof _b != "string") |
| 347 debug("WARN: shouldBecomeDifferent() expects string arguments"); | 348 debug("WARN: shouldBecomeDifferent() expects string arguments"); |
| 348 if (timeout === undefined) | 349 if (timeout === undefined) |
| 349 timeout = 500; | 350 timeout = 500; |
| 350 | 351 |
| 352 var _bv; |
| 351 var condition = function() { | 353 var condition = function() { |
| 352 var exception; | 354 var exception; |
| 353 var _av; | 355 var _av; |
| 354 try { | 356 try { |
| 355 _av = eval(_a); | 357 _av = eval(_a); |
| 356 } catch (e) { | 358 } catch (e) { |
| 357 exception = e; | 359 exception = e; |
| 358 } | 360 } |
| 359 var _bv = eval(_b); | 361 _bv = eval(_b); |
| 360 if (exception) | 362 if (exception) |
| 361 testFailed(_a + " should became not equal to " + _bv + ". Threw exception
" + exception); | 363 testFailed(_a + " should became not equal to " + _bv + ". Threw exception
" + exception); |
| 362 if (!isResultCorrect(_av, _bv)) { | 364 if (!isResultCorrect(_av, _bv)) { |
| 363 testPassed(_a + " became different from " + _b); | 365 testPassed(_a + " became different from " + _b); |
| 364 return true; | 366 return true; |
| 365 } | 367 } |
| 366 return false; | 368 return false; |
| 367 }; | 369 }; |
| 368 var failureTime = Date.now() + timeout; | 370 var failureTime = Date.now() + timeout; |
| 369 var failureHandler = function () { | 371 var failureHandler = function () { |
| 370 testFailed(_a + " did not become different from " + _b + " in " + (timeout /
1000) + " seconds."); | 372 testFailed(_a + " did not become different from " + _bv + " in " + (timeout
/ 1000) + " seconds."); |
| 371 completionHandler(); | 373 completionHandler(); |
| 372 }; | 374 }; |
| 373 _waitForCondition(condition, failureTime, completionHandler, failureHandler); | 375 _waitForCondition(condition, failureTime, completionHandler, failureHandler); |
| 374 } | 376 } |
| 375 | 377 |
| 376 function shouldBeTrue(_a) { shouldBe(_a, "true"); } | 378 function shouldBeTrue(_a) { shouldBe(_a, "true"); } |
| 377 function shouldBeTrueQuiet(_a) { shouldBe(_a, "true", true); } | 379 function shouldBeTrueQuiet(_a) { shouldBe(_a, "true", true); } |
| 378 function shouldBeFalse(_a) { shouldBe(_a, "false"); } | 380 function shouldBeFalse(_a) { shouldBe(_a, "false"); } |
| 379 function shouldBeNaN(_a) { shouldBe(_a, "NaN"); } | 381 function shouldBeNaN(_a) { shouldBe(_a, "NaN"); } |
| 380 function shouldBeNull(_a) { shouldBe(_a, "null"); } | 382 function shouldBeNull(_a) { shouldBe(_a, "null"); } |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 testPassed = function(msg) { | 687 testPassed = function(msg) { |
| 686 workerPort.postMessage('PASS:' + msg); | 688 workerPort.postMessage('PASS:' + msg); |
| 687 } | 689 } |
| 688 finishJSTest = function() { | 690 finishJSTest = function() { |
| 689 workerPort.postMessage('DONE:'); | 691 workerPort.postMessage('DONE:'); |
| 690 } | 692 } |
| 691 debug = function(msg) { | 693 debug = function(msg) { |
| 692 workerPort.postMessage(msg); | 694 workerPort.postMessage(msg); |
| 693 } | 695 } |
| 694 } | 696 } |
| OLD | NEW |