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 share the context.'); |
| 6 |
| 7 (async function test() { |
| 8 var contextGroup = new InspectorTest.ContextGroup(); |
| 9 var session1 = contextGroup.connect(); |
| 10 var session2 = contextGroup.connect(); |
| 11 |
| 12 InspectorTest.log('Assigning in 1'); |
| 13 await session1.Protocol.Runtime.evaluate({expression: 'var a = 42;'}); |
| 14 InspectorTest.log('Evaluating in 2'); |
| 15 InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression:
'a'})); |
| 16 |
| 17 InspectorTest.log('Awaiting in 1'); |
| 18 var promise = session1.Protocol.Runtime.evaluate({expression: 'var cb; new Pro
mise(f => cb = f)', awaitPromise: true}); |
| 19 InspectorTest.log('Resolving in 2'); |
| 20 await session2.Protocol.Runtime.evaluate({expression: 'cb("foo")'}); |
| 21 InspectorTest.log('Should resolve in 1'); |
| 22 InspectorTest.logMessage(await promise); |
| 23 |
| 24 InspectorTest.completeTest(); |
| 25 })(); |
OLD | NEW |