OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 var exception = null; | 32 var exception = null; |
33 var state = 1; | 33 var state = 1; |
34 | 34 |
35 // Simple debug event handler which first time will cause 'step in' action | 35 // Simple debug event handler which first time will cause 'step in' action |
36 // to get into g.call and than check that execution is stopped inside | 36 // to get into g.call and than check that execution is stopped inside |
37 // function 'g'. | 37 // function 'g'. |
38 function listener(event, exec_state, event_data, data) { | 38 function listener(event, exec_state, event_data, data) { |
39 try { | 39 try { |
40 if (event == Debug.DebugEvent.Break) { | 40 if (event == Debug.DebugEvent.Break) { |
41 if (state == 1) { | 41 if (state < 4) { |
42 exec_state.prepareStep(Debug.StepAction.StepIn, 3); | 42 exec_state.prepareStep(Debug.StepAction.StepIn); |
43 state = 2; | 43 state++; |
44 } else if (state == 2) { | 44 } else { |
45 assertTrue(event_data.sourceLineText().indexOf("Expected to step") > 0, | 45 assertTrue(event_data.sourceLineText().indexOf("Expected to step") > 0, |
46 "source line: \"" + event_data.sourceLineText() + "\""); | 46 "source line: \"" + event_data.sourceLineText() + "\""); |
47 state = 3; | 47 state = 5; |
48 } | 48 } |
49 } | 49 } |
50 } catch(e) { | 50 } catch(e) { |
51 print("Exception: " + e); | 51 print("Exception: " + e); |
52 exception = e; | 52 exception = e; |
53 } | 53 } |
54 }; | 54 }; |
55 | 55 |
56 // Add the debug event listener. | 56 // Add the debug event listener. |
57 Debug.setListener(listener); | 57 Debug.setListener(listener); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 var functionsCalled = 0; | 136 var functionsCalled = 0; |
137 for (var n in this) { | 137 for (var n in this) { |
138 if (n.substr(0, 4) != 'test' || typeof this[n] !== "function") { | 138 if (n.substr(0, 4) != 'test' || typeof this[n] !== "function") { |
139 continue; | 139 continue; |
140 } | 140 } |
141 state = 1; | 141 state = 1; |
142 print("Running " + n + "..."); | 142 print("Running " + n + "..."); |
143 this[n](); | 143 this[n](); |
144 ++functionsCalled; | 144 ++functionsCalled; |
145 assertNull(exception, n); | 145 assertNull(exception, n); |
146 assertEquals(3, state, n); | 146 assertEquals(5, state, n); |
147 assertEquals(functionsCalled, count, n); | 147 assertEquals(functionsCalled, count, n); |
148 } | 148 } |
149 | 149 |
150 assertEquals(11, functionsCalled); | 150 assertEquals(11, functionsCalled); |
151 | 151 |
152 // Get rid of the debug event listener. | 152 // Get rid of the debug event listener. |
153 Debug.setListener(null); | 153 Debug.setListener(null); |
OLD | NEW |