| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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: --harmony-async-await --expose-debug-as debug --allow-natives-syntax | 5 // Flags: --harmony-async-await --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 "enqueue #3", |
| 17 'willHandle #2', | 17 "didHandle #1", |
| 18 'then #2', | 18 "willHandle #2", |
| 19 'didHandle #2', | 19 "then #2", |
| 20 "didHandle #2", |
| 21 "willHandle #3", |
| 22 "enqueue #4", |
| 23 "didHandle #3", |
| 24 "willHandle #4", |
| 25 "didHandle #4", |
| 20 ]; | 26 ]; |
| 21 | 27 |
| 22 function assertLog(msg) { | 28 function assertLog(msg) { |
| 23 print(msg); | 29 print(msg); |
| 24 assertTrue(expected.length > 0); | 30 assertTrue(expected.length > 0); |
| 25 assertEquals(expected.shift(), msg); | 31 assertEquals(expected.shift(), msg); |
| 26 if (!expected.length) { | 32 if (!expected.length) { |
| 27 Debug.setListener(null); | 33 Debug.setListener(null); |
| 28 } | 34 } |
| 29 } | 35 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 55 assertLog("then #1"); | 61 assertLog("then #1"); |
| 56 await undefined; | 62 await undefined; |
| 57 assertLog("then #2"); | 63 assertLog("then #2"); |
| 58 } | 64 } |
| 59 main(); | 65 main(); |
| 60 resolver(); | 66 resolver(); |
| 61 | 67 |
| 62 %RunMicrotasks(); | 68 %RunMicrotasks(); |
| 63 | 69 |
| 64 assertNull(exception); | 70 assertNull(exception); |
| OLD | NEW |