3 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
5 if (window
.testRunner
) {
6 testRunner
.dumpAsText();
7 testRunner
.waitUntilDone();
12 InspectorTest
.sendCommand("Profiler.enable", {});
13 InspectorTest
.sendCommand("Profiler.start", {}, didStartFrontendProfile
);
14 function didStartFrontendProfile(messageObject
)
16 if (!InspectorTest
.expectedSuccess("startFrontendProfile", messageObject
))
18 InspectorTest
.sendCommand("Runtime.evaluate", {expression
: "console.profile('Profile 1');"}, didStartConsoleProfile
);
21 function didStartConsoleProfile(messageObject
)
23 if (!InspectorTest
.expectedSuccess("startConsoleProfile", messageObject
))
25 InspectorTest
.sendCommand("Runtime.evaluate", {expression
: "console.profileEnd('Profile 1');"}, didStopConsoleProfile
);
28 function didStopConsoleProfile(messageObject
)
30 if (!InspectorTest
.expectedSuccess("stopConsoleProfile", messageObject
))
32 InspectorTest
.sendCommand("Profiler.stop", {}, didStopFrontendProfile
);
35 function didStopFrontendProfile(messageObject
)
37 if (!InspectorTest
.expectedSuccess("stoppedFrontendProfile", messageObject
))
39 InspectorTest
.sendCommand("Profiler.start", {}, didStartFrontendProfile2
);
42 function didStartFrontendProfile2(messageObject
)
44 if (!InspectorTest
.expectedSuccess("startFrontendProfileSecondTime", messageObject
))
46 InspectorTest
.sendCommand("Profiler.stop", {}, didStopFrontendProfile2
);
49 function didStopFrontendProfile2(messageObject
)
51 InspectorTest
.expectedSuccess("stopFrontendProfileSecondTime", messageObject
)
52 InspectorTest
.completeTest();
57 <body onload=
"runTest()">
59 Test that profiler is able to record a profile.
60 Also it tests that profiler returns an error when it unable to find the profile.