Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / Promise-native-then.html
blob3c5347b8d3847abe5b0abe114cb90d47aacce8ee
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <div id="description"></div>
8 <div id="console"></div>
9 <script>
10 description('Test Promise native then.');
12 window.jsTestIsAsync = true;
14 var resolve;
15 var promise = new Promise(function(r) { resolve = r; });
16 var newPromise = window.internals.addOneToPromise(promise);
18 newPromise.then(function(result) {
19 window.result = result;
20 shouldBe('result', '11');
21 return window.internals.addOneToPromise(result);
22 }).then(function(result) {
23 window.result = result;
24 shouldBe('result', '12');
25 testPassed('DONE');
26 }, function() {
27 testFailed("rejected");
28 }).then(finishJSTest, finishJSTest);
30 resolve(new Promise(function(resolve) { resolve(10); }));
32 </script>
33 </body>
34 </html>