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

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

Issue 23567043: Promise init callback takes resolve and reject functions (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 3 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 description('Test Promise.'); 10 description('Test Promise.');
11 11
12 window.jsTestIsAsync = true; 12 window.jsTestIsAsync = true;
13 13
14 var resolver1, resolver2, resolver3; 14 var resolve1, resolve2, resolve3;
15 var resolver4, resolver5, resolver6; 15 var reject4, resolve5, resolve6;
16 var promise1 = new Promise(function(r) { resolver1 = r; }); 16 var promise1 = new Promise(function(r) { resolve1 = r; });
17 var promise2 = new Promise(function(r) { resolver2 = r; }); 17 var promise2 = new Promise(function(r) { resolve2 = r; });
18 var promise3 = new Promise(function(r) { resolver3 = r; }); 18 var promise3 = new Promise(function(r) { resolve3 = r; });
19 var promise4 = new Promise(function(r) { resolver4 = r; }); 19 var promise4 = new Promise(function(_, r) { reject4 = r; });
20 var promise5 = new Promise(function(r) { resolver5 = r; }); 20 var promise5 = new Promise(function(r) { resolve5 = r; });
21 var promise6 = new Promise(function(r) { resolver6 = r; }); 21 var promise6 = new Promise(function(r) { resolve6 = r; });
22 22
23 resolver3.resolve(promise2); 23 resolve3(promise2);
24 resolver2.resolve(promise1); 24 resolve2(promise1);
25 resolver6.resolve(promise5); 25 resolve6(promise5);
26 resolver5.resolve(promise4); 26 resolve5(promise4);
27 27
28 promise3.then(function(result) { 28 promise3.then(function(result) {
29 window.result = result; 29 window.result = result;
30 shouldBeEqualToString('result', 'hello'); 30 shouldBeEqualToString('result', 'hello');
31 }, function() { 31 }, function() {
32 testFailed('rejected'); 32 testFailed('rejected');
33 }); 33 });
34 34
35 promise6.then(function() { 35 promise6.then(function() {
36 testFailed('fulfilled'); 36 testFailed('fulfilled');
37 finishJSTest(); 37 finishJSTest();
38 }, function(result) { 38 }, function(result) {
39 window.result = result; 39 window.result = result;
40 shouldBeEqualToString('result', 'bye'); 40 shouldBeEqualToString('result', 'bye');
41 finishJSTest(); 41 finishJSTest();
42 }); 42 });
43 43
44 resolver1.resolve('hello'); 44 resolve1('hello');
45 resolver4.reject('bye'); 45 reject4('bye');
46 46
47 </script> 47 </script>
48 <script src="resources/js-test-post.js"></script> 48 <script src="resources/js-test-post.js"></script>
49 </body> 49 </body>
50 </html> 50 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/js/Promise-resolve.html ('k') | LayoutTests/fast/js/Promise-resolve-state.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698