Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector-protocol / cpu-profiler / record-cpu-profile.html
blobc58139863d0c601828e0a567edbb43e4221e5364
1 <html>
2 <head>
3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script>
5 if (window.testRunner) {
6 testRunner.dumpAsText();
7 testRunner.waitUntilDone();
10 function test()
12 InspectorTest.sendCommand("Profiler.enable", {});
13 InspectorTest.sendCommand("Profiler.start", {}, didStartFrontendProfile);
14 function didStartFrontendProfile(messageObject)
16 if (!InspectorTest.expectedSuccess("startFrontendProfile", messageObject))
17 return;
18 InspectorTest.sendCommand("Runtime.evaluate", {expression: "console.profile('Profile 1');"}, didStartConsoleProfile);
21 function didStartConsoleProfile(messageObject)
23 if (!InspectorTest.expectedSuccess("startConsoleProfile", messageObject))
24 return;
25 InspectorTest.sendCommand("Runtime.evaluate", {expression: "console.profileEnd('Profile 1');"}, didStopConsoleProfile);
28 function didStopConsoleProfile(messageObject)
30 if (!InspectorTest.expectedSuccess("stopConsoleProfile", messageObject))
31 return;
32 InspectorTest.sendCommand("Profiler.stop", {}, didStopFrontendProfile);
35 function didStopFrontendProfile(messageObject)
37 if (!InspectorTest.expectedSuccess("stoppedFrontendProfile", messageObject))
38 return;
39 InspectorTest.sendCommand("Profiler.start", {}, didStartFrontendProfile2);
42 function didStartFrontendProfile2(messageObject)
44 if (!InspectorTest.expectedSuccess("startFrontendProfileSecondTime", messageObject))
45 return;
46 InspectorTest.sendCommand("Profiler.stop", {}, didStopFrontendProfile2);
49 function didStopFrontendProfile2(messageObject)
51 InspectorTest.expectedSuccess("stopFrontendProfileSecondTime", messageObject)
52 InspectorTest.completeTest();
55 </script>
56 </head>
57 <body onload="runTest()">
58 <p>
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.
61 </body>
62 </html>