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 all sessions get console api notifications.'); |
| 6 |
| 7 function connect(contextGroup, num) { |
| 8 var session = contextGroup.connect(); |
| 9 session.Protocol.Runtime.onConsoleAPICalled(message => { |
| 10 InspectorTest.log('From session ' + num); |
| 11 InspectorTest.logMessage(message); |
| 12 }); |
| 13 return session; |
| 14 } |
| 15 |
| 16 (async function test() { |
| 17 var contextGroup = new InspectorTest.ContextGroup(); |
| 18 var session1 = connect(contextGroup, 1); |
| 19 var session2 = connect(contextGroup, 2); |
| 20 await session1.Protocol.Runtime.enable(); |
| 21 await session2.Protocol.Runtime.enable(); |
| 22 |
| 23 InspectorTest.log('Error in 2'); |
| 24 await session2.Protocol.Runtime.evaluate({expression: 'console.error(1)'}); |
| 25 |
| 26 InspectorTest.log('Logging in 1'); |
| 27 await session1.Protocol.Runtime.evaluate({expression: 'console.log(2)'}); |
| 28 |
| 29 InspectorTest.log('Error in setTimeout 1'); |
| 30 await session1.Protocol.Runtime.evaluate({expression: 'setTimeout(() => consol
e.error("a"), 0)'}); |
| 31 await InspectorTest.waitForPendingTasks(); |
| 32 |
| 33 InspectorTest.log('Logging in setTimeout 2'); |
| 34 await session2.Protocol.Runtime.evaluate({expression: 'setTimeout(() => consol
e.log("b"), 0)'}); |
| 35 await InspectorTest.waitForPendingTasks(); |
| 36 |
| 37 InspectorTest.completeTest(); |
| 38 })(); |
OLD | NEW |