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

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

Issue 2926533003: 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 < 1000; i++)
12 doSomeWork += i;
13 return doSomeWork;
14 }
15 //# sourceURL=test.js`, 7, 26);
16
17 (async function test() {
18 var session1 = await connect(contextGroup, 1);
19 var session2 = await connect(contextGroup, 2);
20
21 InspectorTest.log('console.profile in 1');
22 await session1.Protocol.Runtime.evaluate({expression: 'console.profile("one"); foo(); console.profileEnd("one");'});
23 InspectorTest.log('console.profile in 2');
24 await session2.Protocol.Runtime.evaluate({expression: 'console.profile("two"); foo(); console.profileEnd("two");'});
25
26 InspectorTest.log('starting in 1');
27 session1.Protocol.Profiler.start();
28 InspectorTest.log('starting in 2');
29 session2.Protocol.Profiler.start();
30 await session1.Protocol.Runtime.evaluate({expression: 'foo();'});
31
32 InspectorTest.log('stopping in 1');
33 var message = await session1.Protocol.Profiler.stop();
34 InspectorTest.log('stopped in 1');
35
36 InspectorTest.log('stopping in 2');
37 var message = await session2.Protocol.Profiler.stop();
38 InspectorTest.log('stopped in 2');
39
40 InspectorTest.completeTest();
41 })();
42
43 async function connect(contextGroup, num) {
44 var session = contextGroup.connect();
45 session.Protocol.Profiler.onConsoleProfileStarted(message => {
46 InspectorTest.log(`console profile started from ${num}: ${message.params.tit le}`);
47 });
48 session.Protocol.Profiler.onConsoleProfileFinished(message => {
49 InspectorTest.log(`console profile finished from ${num}: ${message.params.ti tle}`);
50 });
51 await session.Protocol.Profiler.enable();
52 await session.Protocol.Profiler.setSamplingInterval({interval: 100});
53 return session;
54 }
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