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

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

Issue 209443009: Delete Promises Layout Tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 9 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.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 resolve;
15
16 var firstPromise = new Promise(function(newResolve) {
17 window.thisInInit = this;
18 resolve = newResolve;
19 });
20
21 var secondPromise = firstPromise.then(function(result) {
22 window.thisInFulfillCallback = this;
23 shouldBeFalse('thisInFulfillCallback === firstPromise');
24 shouldBeFalse('thisInFulfillCallback === secondPromise');
25 shouldBeTrue('thisInFulfillCallback === window');
26 window.result = result;
27 shouldBeEqualToString('result', 'hello');
28 return 'world';
29 });
30
31 shouldBeFalse('thisInInit === firstPromise');
32 shouldBeTrue('thisInInit === window');
33 shouldBeTrue('firstPromise instanceof Promise');
34 shouldBeTrue('secondPromise instanceof Promise');
35
36 secondPromise.then(null, 37).then(function(result) {
37 window.result = result;
38 shouldBeEqualToString('result', 'world');
39 throw 'exception'
40 }).then(1, 2).then(function() {
41 testFailed('resolved');
42 }, function(result) {
43 testPassed('rejected');
44 window.result = result;
45 shouldBeEqualToString('result', 'exception');
46 }).then(function() {
47 testPassed('resolved');
48 finishJSTest();
49 }, function() {
50 testFailed('rejected');
51 finishJSTest();
52 });
53
54 resolve('hello');
55
56 </script>
57 </body>
58 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/js/Promise-static-resolve-expected.txt ('k') | LayoutTests/fast/js/Promise-then-callback-receiver.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698