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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 var test_obj = new Test(test_name, properties); | 516 var test_obj = new Test(test_name, properties); |
517 if (func) { | 517 if (func) { |
518 test_obj.step(func, test_obj, test_obj); | 518 test_obj.step(func, test_obj, test_obj); |
519 } | 519 } |
520 return test_obj; | 520 return test_obj; |
521 } | 521 } |
522 | 522 |
523 function promise_test(func, name, properties) { | 523 function promise_test(func, name, properties) { |
524 var test = async_test(name, properties); | 524 var test = async_test(name, properties); |
525 // If there is no promise tests queue make one. | 525 // If there is no promise tests queue make one. |
526 test.step(function() { | 526 if (!tests.promise_tests) { |
527 if (!tests.promise_tests) { | 527 tests.promise_tests = Promise.resolve(); |
528 tests.promise_tests = Promise.resolve(); | 528 } |
529 } | |
530 }); | |
531 tests.promise_tests = tests.promise_tests.then(function() { | 529 tests.promise_tests = tests.promise_tests.then(function() { |
532 return Promise.resolve(test.step(func, test, test)) | 530 return Promise.resolve(test.step(func, test, test)) |
533 .then( | 531 .then( |
534 function() { | 532 function() { |
535 test.done(); | 533 test.done(); |
536 }) | 534 }) |
537 .catch(test.step_func( | 535 .catch(test.step_func( |
538 function(value) { | 536 function(value) { |
539 if (value instanceof AssertionError) { | 537 if (value instanceof AssertionError) { |
540 throw value; | 538 throw value; |
(...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2675 tests.status.status = tests.status.ERROR; | 2673 tests.status.status = tests.status.ERROR; |
2676 tests.status.message = e.message; | 2674 tests.status.message = e.message; |
2677 tests.status.stack = e.stack; | 2675 tests.status.stack = e.stack; |
2678 } | 2676 } |
2679 }); | 2677 }); |
2680 | 2678 |
2681 test_environment.on_tests_ready(); | 2679 test_environment.on_tests_ready(); |
2682 | 2680 |
2683 })(); | 2681 })(); |
2684 // vim: set expandtab shiftwidth=4 tabstop=4: | 2682 // vim: set expandtab shiftwidth=4 tabstop=4: |
OLD | NEW |