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

Side by Side Diff: LayoutTests/fast/js/Promise-init.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 window.jsTestIsAsync = true;
11
12 description('Test Promise.');
13
14 var thisInInit;
15 var resolve, reject;
16 var promise = new Promise(function(newResolve, newReject) {
17 thisInInit = this;
18 resolve = newResolve;
19 reject = newReject;
20 });
21
22 shouldBeTrue('promise instanceof Promise');
23 shouldBe('promise.constructor', 'Promise');
24 shouldBeFalse('thisInInit === promise');
25 shouldBeTrue('thisInInit === window');
26 shouldBeTrue('resolve instanceof Function');
27 shouldBeTrue('reject instanceof Function');
28
29 shouldThrow('new Promise()', '"TypeError: Promise constructor takes a function a rgument"');
30 shouldThrow('new Promise(37)', '"TypeError: Promise constructor takes a function argument"');
31
32 shouldNotThrow('promise = new Promise(function() { throw Error("foo"); })');
33 promise.then(undefined, function(result) {
34 window.result = result;
35 shouldBeEqualToString('result.message', 'foo');
36 });
37
38 new Promise(function(resolve) {
39 resolve("hello");
40 throw Error("foo");
41 }).then(function(result) {
42 window.result = result;
43 testPassed('fulfilled');
44 shouldBeEqualToString('result', 'hello');
45 finishJSTest();
46 }, function(result) {
47 window.result = result;
48 testFailed('rejected');
49 finishJSTest();
50 });
51
52 </script>
53 </body>
54 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/js/Promise-exception-expected.txt ('k') | LayoutTests/fast/js/Promise-init-callback-receiver.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698