Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: test/inspector/sessions/runtime-command-line-api.js

Issue 2916803005: [inspector] Create InjectedScript per session in each context (Closed)
Patch Set: rebased Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 do not share command line api.') ;
6
7 (async function test() {
8 var contextGroup = new InspectorTest.ContextGroup();
9 var session1 = contextGroup.connect();
10 await session1.Protocol.Runtime.enable();
11 session1.Protocol.Runtime.onInspectRequested(message => {
12 InspectorTest.log('inspectRequested from 1');
13 InspectorTest.logMessage(message);
14 });
15 var session2 = contextGroup.connect();
16 await session2.Protocol.Runtime.enable();
17 session2.Protocol.Runtime.onInspectRequested(message => {
18 InspectorTest.log('inspectRequested from 2');
19 InspectorTest.logMessage(message);
20 });
21
22 InspectorTest.log('Setting $0 in 1');
23 await session1.addInspectedObject(42);
24 InspectorTest.log('Evaluating $0 in 1');
25 InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
26 InspectorTest.log('Evaluating $0 in 2');
27 InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
28
29 InspectorTest.log('Setting $0 in 2');
30 await session2.addInspectedObject(17);
31 InspectorTest.log('Evaluating $0 in 1');
32 InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
33 InspectorTest.log('Evaluating $0 in 2');
34 InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
35
36 InspectorTest.log('Setting $_ in 1');
37 await session1.Protocol.Runtime.evaluate({expression: '42', objectGroup: 'cons ole', includeCommandLineAPI: true});
38 InspectorTest.log('Evaluating $_ in 1');
39 InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
40 InspectorTest.log('Evaluating $_ in 2');
41 InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
42
43 InspectorTest.log('Setting $_ in 2');
44 await session2.Protocol.Runtime.evaluate({expression: '17', objectGroup: 'cons ole', includeCommandLineAPI: true});
45 InspectorTest.log('Evaluating $_ in 1');
46 InspectorTest.logMessage(await session1.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
47 InspectorTest.log('Evaluating $_ in 2');
48 InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
49
50 InspectorTest.log('Inspecting in 1');
51 await session1.Protocol.Runtime.evaluate({expression: 'var inspect1=inspect; i nspect(42)', includeCommandLineAPI: true});
52 InspectorTest.log('Inspecting in 1 through variable');
53 await session1.Protocol.Runtime.evaluate({expression: 'inspect1(42)', includeC ommandLineAPI: true});
54 InspectorTest.log('Inspecting in 2');
55 await session2.Protocol.Runtime.evaluate({expression: 'var inspect2=inspect; i nspect(17)', includeCommandLineAPI: true});
56 InspectorTest.log('Inspecting in 2 through variable');
57 await session2.Protocol.Runtime.evaluate({expression: 'inspect2(17)', includeC ommandLineAPI: true});
58 InspectorTest.log('Inspecting in 2 through variable from 1');
59 await session2.Protocol.Runtime.evaluate({expression: 'inspect1(42)', includeC ommandLineAPI: true});
60
61 InspectorTest.log('Disconnecting 1');
62 session1.disconnect();
63
64 InspectorTest.log('Evaluating $0 in 2');
65 InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$0', includeCommandLineAPI: true}));
66 InspectorTest.log('Evaluating $_ in 2');
67 InspectorTest.logMessage(await session2.Protocol.Runtime.evaluate({expression: '$_', includeCommandLineAPI: true}));
68 InspectorTest.log('Inspecting in 2');
69 await session2.Protocol.Runtime.evaluate({expression: 'inspect(17)', includeCo mmandLineAPI: true});
70 InspectorTest.log('Inspecting in 2 through variable from 1');
71 await session2.Protocol.Runtime.evaluate({expression: 'inspect1(42)', includeC ommandLineAPI: true});
72 InspectorTest.log('Inspecting in 2 through variable');
73 await session2.Protocol.Runtime.evaluate({expression: 'inspect2(17)', includeC ommandLineAPI: true});
74
75 InspectorTest.completeTest();
76 })();
OLDNEW
« no previous file with comments | « test/inspector/protocol-test.js ('k') | test/inspector/sessions/runtime-command-line-api-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698