OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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 InspectorTest.log('Tests how multiple sessions interact while pausing, stepping,
setting breakpoints and blackboxing.'); | 5 InspectorTest.log('Tests how multiple sessions interact while pausing, stepping,
setting breakpoints and blackboxing.'); |
6 | 6 |
7 var contextGroup = new InspectorTest.ContextGroup(); | 7 var contextGroup = new InspectorTest.ContextGroup(); |
8 | 8 |
9 contextGroup.addScript(` | 9 contextGroup.addScript(` |
10 function foo() { | 10 function foo() { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 await waitForPaused(session2, 2); | 136 await waitForPaused(session2, 2); |
137 InspectorTest.log('Resuming in 2'); | 137 InspectorTest.log('Resuming in 2'); |
138 session2.Protocol.Debugger.resume(); | 138 session2.Protocol.Debugger.resume(); |
139 await waitForResumed(session2, 2); | 139 await waitForResumed(session2, 2); |
140 | 140 |
141 InspectorTest.log('Skipping pauses in 2'); | 141 InspectorTest.log('Skipping pauses in 2'); |
142 await session2.Protocol.Debugger.setSkipAllPauses({skip: true}); | 142 await session2.Protocol.Debugger.setSkipAllPauses({skip: true}); |
143 InspectorTest.log('Evaluating common breakpoint in 1'); | 143 InspectorTest.log('Evaluating common breakpoint in 1'); |
144 await session1.Protocol.Runtime.evaluate({expression: 'foo();'}); | 144 await session1.Protocol.Runtime.evaluate({expression: 'foo();'}); |
145 | 145 |
| 146 InspectorTest.log('Unskipping pauses in 1'); |
| 147 await session1.Protocol.Debugger.setSkipAllPauses({skip: false}); |
| 148 InspectorTest.log('Unskipping pauses in 2'); |
| 149 await session2.Protocol.Debugger.setSkipAllPauses({skip: false}); |
| 150 |
| 151 InspectorTest.log('Deactivating breakpoints in 1'); |
| 152 await session1.Protocol.Debugger.setBreakpointsActive({active: false}); |
| 153 InspectorTest.log('Evaluating common breakpoint in 1'); |
| 154 session1.Protocol.Runtime.evaluate({expression: 'foo();'}); |
| 155 await waitForPaused(session2, 2); |
| 156 InspectorTest.log('Resuming in 2'); |
| 157 session2.Protocol.Debugger.resume(); |
| 158 await waitForResumed(session2, 2); |
| 159 |
| 160 InspectorTest.log('Deactivating breakpoints in 2'); |
| 161 await session2.Protocol.Debugger.setBreakpointsActive({active: false}); |
| 162 InspectorTest.log('Evaluating common breakpoint in 1'); |
| 163 await session1.Protocol.Runtime.evaluate({expression: 'foo();'}); |
| 164 |
146 InspectorTest.completeTest(); | 165 InspectorTest.completeTest(); |
147 | 166 |
148 function waitForBothPaused() { | 167 function waitForBothPaused() { |
149 return Promise.all([waitForPaused(session1, 1), waitForPaused(session2, 2)])
; | 168 return Promise.all([waitForPaused(session1, 1), waitForPaused(session2, 2)])
; |
150 } | 169 } |
151 | 170 |
152 function waitForBothResumed() { | 171 function waitForBothResumed() { |
153 return Promise.all([waitForResumed(session1, 1), waitForResumed(session2, 2)
]); | 172 return Promise.all([waitForResumed(session1, 1), waitForResumed(session2, 2)
]); |
154 } | 173 } |
155 })(); | 174 })(); |
156 | 175 |
157 function waitForPaused(session, num) { | 176 function waitForPaused(session, num) { |
158 return session.Protocol.Debugger.oncePaused().then(message => { | 177 return session.Protocol.Debugger.oncePaused().then(message => { |
159 InspectorTest.log(`Paused in ${num}:`); | 178 InspectorTest.log(`Paused in ${num}:`); |
160 InspectorTest.log(` reason: ${message.params.reason}`); | 179 InspectorTest.log(` reason: ${message.params.reason}`); |
161 InspectorTest.log(` hit breakpoints: ${(message.params.hitBreakpoints || []
).join(';')}`); | 180 InspectorTest.log(` hit breakpoints: ${(message.params.hitBreakpoints || []
).join(';')}`); |
162 var callFrame = message.params.callFrames[0]; | 181 var callFrame = message.params.callFrames[0]; |
163 InspectorTest.log(` location: ${callFrame.functionName || '<anonymous>'}@${
callFrame.location.lineNumber}`); | 182 InspectorTest.log(` location: ${callFrame.functionName || '<anonymous>'}@${
callFrame.location.lineNumber}`); |
164 InspectorTest.log(` data: ${JSON.stringify(message.params.data || null)}`); | 183 InspectorTest.log(` data: ${JSON.stringify(message.params.data || null)}`); |
165 }); | 184 }); |
166 } | 185 } |
167 | 186 |
168 function waitForResumed(session, num) { | 187 function waitForResumed(session, num) { |
169 return session.Protocol.Debugger.onceResumed().then(message => { | 188 return session.Protocol.Debugger.onceResumed().then(message => { |
170 InspectorTest.log(`Resumed in ${num}`); | 189 InspectorTest.log(`Resumed in ${num}`); |
171 }); | 190 }); |
172 } | 191 } |
OLD | NEW |