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

Side by Side Diff: test/inspector/runtime/create-context.js

Issue 2891213002: [inspector] Refactor protocol-test.js (Closed)
Patch Set: comments addressed Created 3 years, 7 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
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('Checks createContext().'); 5 InspectorTest.log('Checks createContext().');
6 6
7 var executionContextIds = new Set(); 7 var executionContextIds = new Set();
8 var contextGroup = InspectorTest.createContextGroup(); 8 var contextGroup1 = new InspectorTest.ContextGroup();
9 var session = InspectorTest.createSession(contextGroup); 9 var session1 = contextGroup1.connect();
10 setup(InspectorTest.session); 10 setup(session1);
11 setup(session); 11 var contextGroup2 = new InspectorTest.ContextGroup();
12 var session2 = contextGroup2.connect();
13 setup(session2);
12 14
13 Protocol.Runtime.enable() 15 session1.Protocol.Runtime.enable()
14 .then(() => session.Protocol.Runtime.enable({})) 16 .then(() => session2.Protocol.Runtime.enable({}))
15 .then(() => Protocol.Debugger.enable()) 17 .then(() => session1.Protocol.Debugger.enable())
16 .then(() => session.Protocol.Debugger.enable({})) 18 .then(() => session2.Protocol.Debugger.enable({}))
17 .then(InspectorTest.logMessage) 19 .then(InspectorTest.logMessage)
18 .then(() => { 20 .then(() => {
19 Protocol.Runtime.evaluate({ expression: 'debugger;' }); 21 session1.Protocol.Runtime.evaluate({ expression: 'debugger;' });
20 session.Protocol.Runtime.evaluate({expression: 'setTimeout(x => x * 2, 0)'}) ; 22 session2.Protocol.Runtime.evaluate({expression: 'setTimeout(x => x * 2, 0)'} );
21 Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' }); 23 session1.Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' });
22 }) 24 })
23 .then(() => InspectorTest.waitPendingTasks()) 25 .then(() => InspectorTest.waitForPendingTasks())
24 .then(() => { 26 .then(() => {
25 InspectorTest.log(`Reported script's execution id: ${executionContextIds.siz e}`); 27 InspectorTest.log(`Reported script's execution id: ${executionContextIds.siz e}`);
26 executionContextIds.clear(); 28 executionContextIds.clear();
27 }) 29 })
28 .then(() => InspectorTest.session.reconnect()) 30 .then(() => session1.reconnect())
29 .then(() => session.reconnect()) 31 .then(() => session2.reconnect())
30 .then(() => { 32 .then(() => {
31 Protocol.Runtime.evaluate({ expression: 'debugger;' }) 33 session1.Protocol.Runtime.evaluate({ expression: 'debugger;' })
32 session.Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 2, 0)' }); 34 session2.Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 2, 0)' });
33 Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' }); 35 session1.Protocol.Runtime.evaluate({ expression: 'setTimeout(x => x * 3, 0)' });
34 }) 36 })
35 .then(() => InspectorTest.waitPendingTasks()) 37 .then(() => InspectorTest.waitForPendingTasks())
36 .then(() => session.Protocol.Debugger.disable({})) 38 .then(() => session2.Protocol.Debugger.disable({}))
37 .then(() => Protocol.Debugger.disable({})) 39 .then(() => session1.Protocol.Debugger.disable({}))
38 .then(() => InspectorTest.log(`Reported script's execution id: ${executionCont extIds.size}`)) 40 .then(() => InspectorTest.log(`Reported script's execution id: ${executionCont extIds.size}`))
39 .then(InspectorTest.completeTest); 41 .then(InspectorTest.completeTest);
40 42
41 function setup(session) { 43 function setup(session) {
42 session.Protocol.Runtime.onExecutionContextCreated(InspectorTest.logMessage); 44 session.Protocol.Runtime.onExecutionContextCreated(InspectorTest.logMessage);
43 InspectorTest.setupScriptMap(session); 45 session.setupScriptMap();
44 session.Protocol.Debugger.onPaused((message) => { 46 session.Protocol.Debugger.onPaused((message) => {
45 InspectorTest.logSourceLocation(message.params.callFrames[0].location, sessi on); 47 session.logSourceLocation(message.params.callFrames[0].location);
46 session.Protocol.Debugger.stepOut(); 48 session.Protocol.Debugger.stepOut();
47 }); 49 });
48 session.Protocol.Debugger.onScriptParsed(message => executionContextIds.add(me ssage.params.executionContextId)); 50 session.Protocol.Debugger.onScriptParsed(message => executionContextIds.add(me ssage.params.executionContextId));
49 } 51 }
OLDNEW
« no previous file with comments | « test/inspector/runtime/console-timestamp-expected.txt ('k') | test/inspector/runtime/es6-module.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698