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 | 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 = 10; |
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 + "."); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 return break_count; // Break 4. | 58 return break_count; // Break 4. |
59 } // Break 5. | 59 } // Break 5. |
60 | 60 |
61 function promise4() { | 61 function promise4() { |
62 finalize(); // Break 6. StepOver. | 62 finalize(); // Break 6. StepOver. |
63 return 0; // Break 7. | 63 return 0; // Break 7. |
64 } // Break 8. StepOut. | 64 } // Break 8. StepOut. |
65 | 65 |
66 function finalize() { | 66 function finalize() { |
67 Promise.resolve().then(function() { | 67 Promise.resolve().then(function() { |
68 if (expected_breaks !== break_count) { | 68 if (expected_breaks !== break_count) { // Break 9. StepOut. |
69 %AbortJS("FAIL: expected <" + expected_breaks + "> breaks instead of <" + | 69 %AbortJS("FAIL: expected <" + expected_breaks + "> breaks instead of <" + |
70 break_count + ">"); | 70 break_count + ">"); |
71 } | 71 } |
72 if (exception !== null) { | 72 if (exception !== null) { |
73 %AbortJS("FAIL: exception: " + exception); | 73 %AbortJS("FAIL: exception: " + exception); |
74 } | 74 } |
75 }); | 75 }); |
76 } | 76 } |
OLD | NEW |