| 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 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (!tests.promise_tests) { | 526 if (!tests.promise_tests) { |
| 527 tests.promise_tests = Promise.resolve(); | 527 tests.promise_tests = Promise.resolve(); |
| 528 } | 528 } |
| 529 tests.promise_tests = tests.promise_tests.then(function() { | 529 tests.promise_tests = tests.promise_tests.then(function() { |
| 530 return Promise.resolve(test.step(func, test, test)) | 530 var promise = test.step(func, test, test); |
| 531 test.step(function() { |
| 532 assert_not_equals(promise, undefined); |
| 533 }); |
| 534 return Promise.resolve(promise) |
| 531 .then( | 535 .then( |
| 532 function() { | 536 function() { |
| 533 test.done(); | 537 test.done(); |
| 534 }) | 538 }) |
| 535 .catch(test.step_func( | 539 .catch(test.step_func( |
| 536 function(value) { | 540 function(value) { |
| 537 if (value instanceof AssertionError) { | 541 if (value instanceof AssertionError) { |
| 538 throw value; | 542 throw value; |
| 539 } | 543 } |
| 540 assert(false, "promise_test", null, | 544 assert(false, "promise_test", null, |
| (...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 tests.status.status = tests.status.ERROR; | 2683 tests.status.status = tests.status.ERROR; |
| 2680 tests.status.message = e.message; | 2684 tests.status.message = e.message; |
| 2681 tests.status.stack = e.stack; | 2685 tests.status.stack = e.stack; |
| 2682 } | 2686 } |
| 2683 }); | 2687 }); |
| 2684 | 2688 |
| 2685 test_environment.on_tests_ready(); | 2689 test_environment.on_tests_ready(); |
| 2686 | 2690 |
| 2687 })(); | 2691 })(); |
| 2688 // vim: set expandtab shiftwidth=4 tabstop=4: | 2692 // vim: set expandtab shiftwidth=4 tabstop=4: |
| OLD | NEW |