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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/cpu-profiler/enable-disable.js

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: unified 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 (async function() {
2 let {page, session, Protocol} = await InspectorTest.startBlank(
3 'Test that profiling can only be started when Profiler was enabled and tha t ' +
4 'Profiler.disable command will stop recording all profiles.');
5
6 var allowConsoleProfiles = false;
7 Protocol.Profiler.onConsoleProfileStarted(messageObject => {
8 if (allowConsoleProfiles)
9 InspectorTest.log('PASS: console initiated profile started')
10 else
11 InspectorTest.log('FAIL: console profile started ' + JSON.stringify(messag eObject, null, 4));
12 });
13 Protocol.Profiler.onConsoleProfileFinished(messageObject => {
14 if (allowConsoleProfiles)
15 InspectorTest.log('PASS: console initiated profile received')
16 else
17 InspectorTest.log('FAIL: unexpected profile received ' + JSON.stringify(me ssageObject, null, 4));
18 });
19
20 var messageObject = await Protocol.Profiler.start();
21 if (!InspectorTest.expectedError('didFailToStartWhenDisabled', messageObject))
22 return;
23
24 allowConsoleProfiles = true;
25 Protocol.Profiler.enable();
26 messageObject = await Protocol.Profiler.start();
27 if (!InspectorTest.expectedSuccess('didStartFrontendProfile', messageObject))
28 return;
29
30 messageObject = await Protocol.Runtime.evaluate({expression: 'console.profile( "p1");'});
31 if (!InspectorTest.expectedSuccess('didStartConsoleProfile', messageObject))
32 return;
33
34 messageObject = await Protocol.Profiler.disable();
35 if (!InspectorTest.expectedSuccess('didDisableProfiler', messageObject))
36 return;
37
38 Protocol.Profiler.enable();
39 messageObject = await Protocol.Profiler.stop();
40 if (!InspectorTest.expectedError('no front-end initiated profiles found', mess ageObject))
41 return;
42 allowConsoleProfiles = false;
43
44 messageObject = await Protocol.Runtime.evaluate({expression: 'console.profileE nd();'});
45 if (!InspectorTest.expectedSuccess('didStopConsoleProfile', messageObject))
46 return;
47 InspectorTest.completeTest();
48 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698