OLD | NEW |
1 /*global self*/ | 1 /*global self*/ |
2 /*jshint latedef: nofunc*/ | 2 /*jshint latedef: nofunc*/ |
3 /* | 3 /* |
4 Distributed under both the W3C Test Suite License [1] and the W3C | 4 Distributed under both the W3C Test Suite License [1] and the W3C |
5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the | 5 3-clause BSD License [2]. To contribute to a W3C Test Suite, see the |
6 policies and contribution forms [3]. | 6 policies and contribution forms [3]. |
7 | 7 |
8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license | 8 [1] http://www.w3.org/Consortium/Legal/2008/04-testsuite-license |
9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license | 9 [2] http://www.w3.org/Consortium/Legal/2008/03-bsd-license |
10 [3] http://www.w3.org/2004/10/27-testcases | 10 [3] http://www.w3.org/2004/10/27-testcases |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 function(value) { | 533 function(value) { |
534 if (value instanceof AssertionError) { | 534 if (value instanceof AssertionError) { |
535 throw value; | 535 throw value; |
536 } | 536 } |
537 assert(false, "promise_test", null, | 537 assert(false, "promise_test", null, |
538 "Unhandled rejection with value: ${value}", {valu
e:value}); | 538 "Unhandled rejection with value: ${value}", {valu
e:value}); |
539 })); | 539 })); |
540 }); | 540 }); |
541 } | 541 } |
542 | 542 |
543 function promise_rejects(test, expected, promise) { | 543 function promise_rejects(test, expected, promise, description) { |
544 return promise.then(test.unreached_func("Should have rejected.")).catch(
function(e) { | 544 return promise.then(test.unreached_func("Should have rejected: " + descr
iption)).catch(function(e) { |
545 assert_throws(expected, function() { throw e }); | 545 assert_throws(expected, function() { throw e }, description); |
546 }); | 546 }); |
547 } | 547 } |
548 | 548 |
549 /** | 549 /** |
550 * This constructor helper allows DOM events to be handled using Promises, | 550 * This constructor helper allows DOM events to be handled using Promises, |
551 * which can make it a lot easier to test a very specific series of events, | 551 * which can make it a lot easier to test a very specific series of events, |
552 * including ensuring that unexpected events are not fired at any point. | 552 * including ensuring that unexpected events are not fired at any point. |
553 */ | 553 */ |
554 function EventWatcher(test, watchedNode, eventTypes) | 554 function EventWatcher(test, watchedNode, eventTypes) |
555 { | 555 { |
(...skipping 2110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2666 tests.status.status = tests.status.ERROR; | 2666 tests.status.status = tests.status.ERROR; |
2667 tests.status.message = e.message; | 2667 tests.status.message = e.message; |
2668 tests.status.stack = e.stack; | 2668 tests.status.stack = e.stack; |
2669 } | 2669 } |
2670 }); | 2670 }); |
2671 | 2671 |
2672 test_environment.on_tests_ready(); | 2672 test_environment.on_tests_ready(); |
2673 | 2673 |
2674 })(); | 2674 })(); |
2675 // vim: set expandtab shiftwidth=4 tabstop=4: | 2675 // vim: set expandtab shiftwidth=4 tabstop=4: |
OLD | NEW |