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

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

Issue 2476303003: Revert of [debugger] Migrate more debugger tests to inspector (Closed)
Patch Set: Created 4 years, 1 month 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 // 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
5
6 var Debug = debug.Debug;
7 var listenerComplete = false;
8 var exception = null;
9 var count = 0;
10 var log = [];
11 var done = false;
12
13 function LogX(x) {
14 var stored_count = count;
15 return function() {
16 log.push(`[${stored_count}] ${x}`);
17 };
18 }
19
20 function DebuggerStatement() {
21 log.push(`[${count}] debugger`);
22 if (count++ < 3) {
23 debugger;
24 }
25 }
26
27 function listener(event, exec_state, event_data, data) {
28 if (event != Debug.DebugEvent.Break) return;
29 try {
30 var p = Promise.resolve();
31 var q = p.then(LogX("then 1"));
32 p.then(LogX("then 2"));
33 q.then(LogX("then 3"));
34 q.then(DebuggerStatement);
35 var r = q.then(() => { throw 1; });
36 r.catch(LogX("catch"));
37 listenerComplete = true;
38 } catch (e) {
39 exception = e;
40 print(e, e.stack);
41 quit(1);
42 };
43 };
44
45 // Add the debug event listener.
46 Debug.setListener(listener);
47
48 DebuggerStatement();
49 LogX("start")();
50
51 // Make sure that the debug event listener was invoked.
52 assertTrue(listenerComplete);
53
54 %RunMicrotasks();
55
56 var expectation =
57 [ "[0] debugger", "[1] start", "[1] then 1",
58 "[1] then 2", "[1] then 3", "[1] debugger",
59 "[2] then 1", "[2] then 2", "[1] catch",
60 "[2] then 3", "[2] debugger", "[3] then 1",
61 "[3] then 2", "[2] catch", "[3] then 3",
62 "[3] debugger", "[3] catch",
63 ];
64
65 assertEquals(expectation, log);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698