Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(648)

Side by Side Diff: LayoutTests/fast/js/Promise-init.html

Issue 17874002: [ABANDONED] Implement non-static methods of Promise and PromiseResolver. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="resources/js-test-pre.js"></script> 4 <script src="resources/js-test-pre.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <div id="description"></div> 7 <div id="description"></div>
8 <div id="console"></div> 8 <div id="console"></div>
9 <script> 9 <script>
10 if (window.testRunner) 10 window.jsTestIsAsync = true;
11 testRunner.dumpAsText();
12 11
13 description('Test Promise.'); 12 description('Test Promise.');
14 13
15 var thisInInit; 14 var thisInInit;
16 var resolver; 15 var resolver;
17 var promise = new Promise(function(r) { 16 var promise = new Promise(function(r) {
18 thisInInit = this; 17 thisInInit = this;
19 resolver = r; 18 resolver = r;
20 }); 19 });
21 20
22 shouldBeTrue('promise instanceof Promise'); 21 shouldBeTrue('promise instanceof Promise');
23 shouldBe('promise.constructor', 'Promise'); 22 shouldBe('promise.constructor', 'Promise');
24 shouldBe('thisInInit', 'promise'); 23 shouldBe('thisInInit', 'promise');
25 shouldBeTrue('resolver instanceof PromiseResolver'); 24 shouldBeTrue('resolver instanceof PromiseResolver');
26 shouldBe('resolver.constructor', 'PromiseResolver'); 25 shouldBe('resolver.constructor', 'PromiseResolver');
27 26
28 shouldThrow('new Promise()', '"TypeError: Promise constructor takes a function a rgument"'); 27 shouldThrow('new Promise()', '"TypeError: Promise constructor takes a function a rgument"');
29 shouldThrow('new Promise(37)', '"TypeError: Promise constructor takes a function argument"'); 28 shouldThrow('new Promise(37)', '"TypeError: Promise constructor takes a function argument"');
30 29
31 shouldNotThrow('promise = new Promise(function() { throw Error("foo"); })'); 30 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. 31 promise.then(undefined, function(result) {
32 window.result = result;
33 shouldBeEqualToString('result.message', 'foo');
34 finishJSTest();
35 });
33 36
34 </script> 37 </script>
35 <script src="resources/js-test-post.js"></script> 38 <script src="resources/js-test-post.js"></script>
36 </body> 39 </body>
37 </html> 40 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/js/Promise-fulfill-expected.txt ('k') | LayoutTests/fast/js/Promise-init-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698