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

Side by Side Diff: test/debugger/debug/es6/debug-stepin-microtasks.js

Issue 2530533002: [debug-wrapper] adapt stepping tests to inspector behavior. (Closed)
Patch Set: Created 4 years 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 | test/debugger/debug/regress/regress-crbug-568477-1.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 Debug = debug.Debug 6 Debug = debug.Debug
7 var exception = null; 7 var exception = null;
8 var break_count = 0; 8 var break_count = 0;
9 const expected_breaks = 9; 9 const expected_breaks = 9;
10 10
11 function listener(event, exec_state, event_data, data) { 11 function listener(event, exec_state, event_data, data) {
12 try { 12 try {
13 if (event == Debug.DebugEvent.Break) { 13 if (event == Debug.DebugEvent.Break) {
14 assertTrue(exec_state.frameCount() != 0, "FAIL: Empty stack trace"); 14 assertTrue(exec_state.frameCount() != 0, "FAIL: Empty stack trace");
15 var source = exec_state.frame(0).sourceLineText(); 15 var source = exec_state.frame(0).sourceLineText();
16 print("paused at: " + source); 16 print("paused at: " + source);
17 assertTrue(source.indexOf("// Break " + break_count + ".") > 0, 17 assertTrue(source.indexOf("// Break " + break_count + ".") > 0,
18 "Unexpected pause at: " + source + "\n" + 18 "Unexpected pause at: " + source + "\n" +
19 "Expected: // Break " + break_count + "."); 19 "Expected: // Break " + break_count + ".");
20 if (source.indexOf("StepOver.") !== -1) { 20 if (source.indexOf("StepOver.") !== -1) {
21 exec_state.prepareStep(Debug.StepAction.StepNext); 21 exec_state.prepareStep(Debug.StepAction.StepNext);
22 } else if (source.indexOf("StepOut.") !== -1) {
23 exec_state.prepareStep(Debug.StepAction.StepOut);
22 } else { 24 } else {
23 exec_state.prepareStep(Debug.StepAction.StepIn); 25 exec_state.prepareStep(Debug.StepAction.StepIn);
24 } 26 }
25 ++break_count; 27 ++break_count;
26 } 28 }
27 } catch (e) { 29 } catch (e) {
28 exception = e; 30 exception = e;
29 print(e, e.stack); 31 print(e, e.stack);
30 } 32 }
31 }; 33 };
32 34
33 Debug.setListener(listener); 35 Debug.setListener(listener);
34 36
35 Promise.resolve(42) 37 Promise.resolve(42)
36 .then(promise1) 38 .then(promise1)
37 .then(Object) // Should skip stepping into native. 39 .then(Object) // Should skip stepping into native.
38 .then(Boolean) // Should skip stepping into native. 40 .then(Boolean) // Should skip stepping into native.
39 .then(promise2) 41 .then(promise2)
40 .catch(promise3) 42 .catch(promise3)
41 .then(promise4) 43 .then(promise4)
42 .catch(function(e) { 44 .catch(function(e) {
43 %AbortJS("FAIL: uncaught exception " + e); 45 %AbortJS("FAIL: uncaught exception " + e);
44 }); 46 });
45 47
46 function promise1() { 48 function promise1() {
47 debugger; // Break 0. 49 debugger; // Break 0.
48 return exception || 1; // Break 1. 50 return exception || 1; // Break 1.
49 } // Break 2. 51 } // Break 2. StepOver.
50 52
51 function promise2() { 53 function promise2() {
52 throw new Error; // Break 3. 54 throw new Error; // Break 3.
53 } 55 }
54 56
55 function promise3() { 57 function promise3() {
56 return break_count; // Break 4. 58 return break_count; // Break 4.
57 } // Break 5. 59 } // Break 5.
58 60
59 function promise4() { 61 function promise4() {
60 finalize(); // Break 6. StepOver. 62 finalize(); // Break 6. StepOver.
61 return 0; // Break 7. 63 return 0; // Break 7.
62 } // Break 8. StepOver. 64 } // Break 8. StepOut.
63 65
64 function finalize() { 66 function finalize() {
65 Promise.resolve().then(function() { 67 Promise.resolve().then(function() {
66 if (expected_breaks !== break_count) { 68 if (expected_breaks !== break_count) {
67 %AbortJS("FAIL: expected <" + expected_breaks + "> breaks instead of <" + 69 %AbortJS("FAIL: expected <" + expected_breaks + "> breaks instead of <" +
68 break_count + ">"); 70 break_count + ">");
69 } 71 }
70 if (exception !== null) { 72 if (exception !== null) {
71 %AbortJS("FAIL: exception: " + exception); 73 %AbortJS("FAIL: exception: " + exception);
72 } 74 }
73 }); 75 });
74 } 76 }
OLDNEW
« no previous file with comments | « no previous file | test/debugger/debug/regress/regress-crbug-568477-1.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698