OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 InspectorTest.log('Tests that multiple sessions pause once on console.assert.'); |
| 6 |
| 7 (async function test() { |
| 8 var contextGroup1 = new InspectorTest.ContextGroup(); |
| 9 var session1 = await connect(contextGroup1, 1); |
| 10 var session2 = await connect(contextGroup1, 2); |
| 11 var contextGroup2 = new InspectorTest.ContextGroup(); |
| 12 var session3 = await connect(contextGroup2, 3); |
| 13 |
| 14 InspectorTest.log('Pausing on exceptions in 1'); |
| 15 await session1.Protocol.Debugger.setPauseOnExceptions({state: 'all'}); |
| 16 InspectorTest.log('Asserting in 1'); |
| 17 await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'}
); |
| 18 InspectorTest.log('Asserting in 2'); |
| 19 await session2.Protocol.Runtime.evaluate({expression: 'console.assert(false)'}
); |
| 20 |
| 21 InspectorTest.log('Pausing on exceptions in both'); |
| 22 await session2.Protocol.Debugger.setPauseOnExceptions({state: 'all'}); |
| 23 InspectorTest.log('Asserting in 1'); |
| 24 await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'}
); |
| 25 InspectorTest.log('Asserting in 2'); |
| 26 await session2.Protocol.Runtime.evaluate({expression: 'console.assert(false)'}
); |
| 27 |
| 28 InspectorTest.log('Not pausing on exceptions'); |
| 29 await session1.Protocol.Debugger.setPauseOnExceptions({state: 'none'}); |
| 30 await session2.Protocol.Debugger.setPauseOnExceptions({state: 'none'}); |
| 31 InspectorTest.log('Asserting in 1'); |
| 32 await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'}
); |
| 33 InspectorTest.log('Asserting in 2'); |
| 34 await session2.Protocol.Runtime.evaluate({expression: 'console.assert(false)'}
); |
| 35 |
| 36 InspectorTest.log('Pausing on exceptions in 3 (different context group)'); |
| 37 await session3.Protocol.Debugger.setPauseOnExceptions({state: 'all'}); |
| 38 InspectorTest.log('Asserting in 3'); |
| 39 await session3.Protocol.Runtime.evaluate({expression: 'console.assert(false)'}
); |
| 40 InspectorTest.log('Asserting in 1'); |
| 41 await session1.Protocol.Runtime.evaluate({expression: 'console.assert(false)'}
); |
| 42 |
| 43 InspectorTest.completeTest(); |
| 44 })(); |
| 45 |
| 46 async function connect(contextGroup, num) { |
| 47 var session = contextGroup.connect(); |
| 48 await session.Protocol.Debugger.enable(); |
| 49 session.Protocol.Debugger.onPaused(message => { |
| 50 InspectorTest.log(`Paused in ${num} with reason ${message.params.reason}`); |
| 51 session.Protocol.Debugger.resume(); |
| 52 }); |
| 53 return session; |
| 54 } |
OLD | NEW |