OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --expose-debug-as debug | 5 // Flags: --expose-debug-as debug --allow-natives-syntax |
6 | 6 |
7 Debug = debug.Debug; | 7 Debug = debug.Debug; |
8 | 8 |
9 var base_id = -1; | 9 var base_id = -1; |
10 var exception = null; | 10 var exception = null; |
11 var expected = [ | 11 var expected = [ |
12 "enqueue #1", | 12 "enqueue #1", |
13 "willHandle #1", | 13 "willHandle #1", |
14 "then #1", | 14 "then #1", |
15 "enqueue #2", | 15 "enqueue #2", |
16 "didHandle #1", | 16 "didHandle #1", |
17 "willHandle #2", | 17 "willHandle #2", |
18 "then #2", | 18 "then #2", |
| 19 "didHandle #2", |
19 "enqueue #3", | 20 "enqueue #3", |
20 "didHandle #2", | |
21 "willHandle #3", | 21 "willHandle #3", |
22 "didHandle #3" | 22 "didHandle #3" |
23 ]; | 23 ]; |
24 | 24 |
25 function assertLog(msg) { | 25 function assertLog(msg) { |
26 print(msg); | 26 print(msg); |
27 assertTrue(expected.length > 0); | 27 assertTrue(expected.length > 0); |
28 assertEquals(expected.shift(), msg); | 28 assertEquals(expected.shift(), msg); |
29 if (!expected.length) { | 29 if (!expected.length) { |
30 Debug.setListener(null); | 30 Debug.setListener(null); |
(...skipping 20 matching lines...) Expand all Loading... |
51 var p = new Promise(function(resolve, reject) { | 51 var p = new Promise(function(resolve, reject) { |
52 resolver = resolve; | 52 resolver = resolve; |
53 }); | 53 }); |
54 p.then(function() { | 54 p.then(function() { |
55 assertLog("then #1"); | 55 assertLog("then #1"); |
56 }).then(function() { | 56 }).then(function() { |
57 assertLog("then #2"); | 57 assertLog("then #2"); |
58 }); | 58 }); |
59 resolver(); | 59 resolver(); |
60 | 60 |
| 61 %RunMicrotasks(); |
| 62 |
61 assertNull(exception); | 63 assertNull(exception); |
OLD | NEW |