OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="resources/js-test-pre.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <div id="description"></div> |
| 8 <div id="console"></div> |
| 9 <script> |
| 10 if (window.testRunner) |
| 11 testRunner.dumpAsText(); |
| 12 |
| 13 description('Test Promise.'); |
| 14 |
| 15 var thisInInit; |
| 16 var resolver; |
| 17 var promise = new Promise(function(r) { |
| 18 thisInInit = this; |
| 19 resolver = r; |
| 20 }); |
| 21 |
| 22 shouldBeTrue('promise instanceof Promise'); |
| 23 shouldBe('promise.constructor', 'Promise'); |
| 24 shouldBe('thisInInit', 'promise'); |
| 25 shouldBeTrue('resolver instanceof PromiseResolver'); |
| 26 shouldBe('resolver.constructor', 'PromiseResolver'); |
| 27 |
| 28 shouldThrow('new Promise()', '"TypeError: Promise constructor takes a function a
rgument"'); |
| 29 shouldThrow('new Promise(37)', '"TypeError: Promise constructor takes a function
argument"'); |
| 30 |
| 31 shouldNotThrow('promise = new Promise(function() { throw Error("foo"); })'); |
| 32 // FIXME: We can't test if the promise is rejected now, but should test it in th
e future. |
| 33 |
| 34 </script> |
| 35 <script src="resources/js-test-post.js"></script> |
| 36 </body> |
| 37 </html> |
OLD | NEW |