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

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

Issue 18878002: Refactoring on DOM/Promises (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
(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 description('Test Promise.');
11
12 window.jsTestIsAsync = true;
13
14 var resolver1, resolver2, resolver3;
15 var resolver4, resolver5, resolver6;
16 var promise1 = new Promise(function(r) { resolver1 = r; });
17 var promise2 = new Promise(function(r) { resolver2 = r; });
18 var promise3 = new Promise(function(r) { resolver3 = r; });
19 var promise4 = new Promise(function(r) { resolver4 = r; });
20 var promise5 = new Promise(function(r) { resolver5 = r; });
21 var promise6 = new Promise(function(r) { resolver6 = r; });
22
23 resolver3.resolve(promise2);
24 resolver2.resolve(promise1);
25 resolver6.resolve(promise5);
26 resolver5.resolve(promise4);
27
28 promise3.then(function(result) {
29 window.result = result;
30 shouldBeEqualToString('result', 'hello');
31 }, function() {
32 testFailed('rejected');
33 });
34
35 promise6.then(function() {
36 testFailed('fulfilled');
37 finishJSTest();
38 }, function(result) {
39 window.result = result;
40 shouldBeEqualToString('result', 'bye');
41 finishJSTest();
42 });
43
44 resolver1.resolve('hello');
45 resolver4.reject('bye');
46
47 </script>
48 <script src="resources/js-test-post.js"></script>
49 </body>
50 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698