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

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

Issue 16838012: [ABANDONED] Implement Promises. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 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 resolver;
15
16 var firstPromise = new Promise(function(newResolver) {
17 window.thisInInit = this;
18 resolver = newResolver;
19 });
20
21 var secondPromise = firstPromise.then(function() {
22 debug("FAIL fulfilled");
23 }, function(value) {
24 window.thisInFulfillCallback = this;
25 shouldBeFalse("thisInFulfillCallback === firstPromise");
26 shouldBeTrue("thisInFulfillCallback === secondPromise");
27 window.value = value;
28 shouldBeEqualToString("value", "hello");
29 });
30
31 secondPromise.then(function() {
32 debug("PASS fulfilled");
33 finishJSTest();
34 }, function() {
35 debug("FAIL rejected");
36 finishJSTest();
37 }, function() {
38 });
39
40 shouldBeTrue("thisInInit === firstPromise");
41 shouldBeTrue("firstPromise instanceof Promise");
42 shouldBeTrue("secondPromise instanceof Promise");
43
44 resolver.reject("hello");
45
46 </script>
47 <script src="resources/js-test-post.js"></script>
48 </body>
49 </html>
50 });
51
52 shouldBeTrue("thisInInit === firstPromise");
53 shouldBeTrue("firstPromise instanceof Promise");
54 shouldBeTrue("secondPromise instanceof Promise");
55
56 resolver.reject("hello");
57
58 </script>
59 <script src="resources/js-test-post.js"></script>
60 </body>
61 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698