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

Side by Side Diff: test/inspector/sessions/cpu-profile.js

Issue 2928493002: Revert of [inspector] Test how Profiler interacts with multiple sessions (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | test/inspector/sessions/cpu-profile-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 can record profiles concurrently .');
6
7 var contextGroup = new InspectorTest.ContextGroup();
8 contextGroup.addScript(`
9 function foo() {
10 var doSomeWork = 1;
11 for (var i = 0; i < 10000000; i++)
12 doSomeWork += i;
13 return doSomeWork;
14 }
15 //# sourceURL=test.js`, 7, 26);
16
17 function checkProfile(profile) {
18 var foundFoo = profile.nodes.some(node => node.callFrame.functionName === 'foo ');
19 InspectorTest.log(`Found foo() call in profile: ${foundFoo}`);
20 }
21
22 (async function test() {
23 var session1 = await connect(contextGroup, 1);
24 var session2 = await connect(contextGroup, 2);
25
26 InspectorTest.log('console.profile in 1');
27 await session1.Protocol.Runtime.evaluate({expression: 'console.profile("one"); foo(); console.profileEnd("one");'});
28 InspectorTest.log('console.profile in 2');
29 await session2.Protocol.Runtime.evaluate({expression: 'console.profile("two"); foo(); console.profileEnd("two");'});
30
31 InspectorTest.log('starting in 1');
32 session1.Protocol.Profiler.start();
33 InspectorTest.log('starting in 2');
34 session2.Protocol.Profiler.start();
35 await session1.Protocol.Runtime.evaluate({expression: 'foo();'});
36
37 InspectorTest.log('stopping in 1');
38 var message = await session1.Protocol.Profiler.stop();
39 InspectorTest.log('stopped in 1');
40 checkProfile(message.result.profile);
41
42 InspectorTest.log('stopping in 2');
43 var message = await session2.Protocol.Profiler.stop();
44 InspectorTest.log('stopped in 2');
45 checkProfile(message.result.profile);
46
47 InspectorTest.completeTest();
48 })();
49
50 async function connect(contextGroup, num) {
51 var session = contextGroup.connect();
52 session.Protocol.Profiler.onConsoleProfileStarted(message => {
53 InspectorTest.log(`console profile started from ${num}: ${message.params.tit le}`);
54 });
55 session.Protocol.Profiler.onConsoleProfileFinished(message => {
56 InspectorTest.log(`console profile finished from ${num}: ${message.params.ti tle}`);
57 checkProfile(message.params.profile);
58 });
59 await session.Protocol.Profiler.enable();
60 await session.Protocol.Profiler.setSamplingInterval({interval: 100});
61 return session;
62 }
OLDNEW
« no previous file with comments | « no previous file | test/inspector/sessions/cpu-profile-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698