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

Side by Side Diff: test/mjsunit/es6/debug-promises/evaluate-across-microtasks.js

Issue 2021013002: [debugger] add test case for debug-evaluation with promise microtasks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4 // Flags: --expose-debug-as debug
5
6 var Debug = debug.Debug;
7 var listenerComplete = false;
8 var exception = null;
9 var count = 0;
10 var log = [];
11
12 function LogX(x) {
13 var stored_count = count;
14 return function() {
15 log.push(`[${stored_count}] ${x}`);
16 };
17 }
18
19 var expectation = [ "[0] debugger", "[1] start", "[1] then 1", "[1] then 2",
20 "[1] then 3", "[1] debugger", "[2] then 1", "[2] then 2",
21 "[1] catch", "[2] then 3", "[2] debugger", "[3] then 1",
22 "[3] then 2", "[2] catch", "[3] then 3", "[3] debugger" ];
23
24 function DebuggerStatement() {
25 log.push(`[${count}] debugger`);
26 if (count++ < 3) {
27 debugger;
28 } else {
29 try {
caitp (gmail) 2016/05/31 11:44:32 I think we hit this because d8 won't die if the mi
Yang 2016/06/01 08:55:21 Good point. I haven't found a good way to do this
Dan Ehrenberg 2016/06/01 10:38:13 Maybe you could use the new %RunMicrotasks call, w
30 assertEquals(expectation, log);
31 } catch (e) {
32 print(e, e.stack);
33 quit(1);
34 }
35 }
36 }
37
38 function listener(event, exec_state, event_data, data) {
39 if (event != Debug.DebugEvent.Break) return;
40 try {
41 var p = Promise.resolve();
42 var q = p.then(LogX("then 1"));
43 p.then(LogX("then 2"));
44 q.then(LogX("then 3"));
45 q.then(DebuggerStatement);
46 var r = q.then(() => { throw 1; });
47 r.catch(LogX("catch"));
48 listenerComplete = true;
49 } catch (e) {
50 exception = e;
51 print("failure");
caitp (gmail) 2016/05/31 11:44:32 if we fail here, it would be helpful to print the
Yang 2016/06/01 08:55:21 Done.
52 quit(1);
53 };
54 };
55
56 // Add the debug event listener.
57 Debug.setListener(listener);
58
59 DebuggerStatement();
60 LogX("start")();
61
62 // Make sure that the debug event listener was invoked.
63 assertTrue(listenerComplete);
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698