Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / sources / debugger-ui / monitor-console-command.html
blobf58e6ede4c942ec47cfed5f17cb4a9f1e4ebfa3c
1 <html>
2 <head>
3 <script src="../../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../../http/tests/inspector/debugger-test.js"></script>
5 <script src="../../../http/tests/inspector/console-test.js"></script>
7 <script>
8 function simpleTestFunction()
10 return 0;
12 </script>
14 <script>
15 function simpleTestFunction2()
17 return simpleTestFunction3();
20 function simpleTestFunction3()
22 return 0;
24 </script>
26 <script>
27 var test = function()
29 var currentSourceFrame;
30 InspectorTest.setQuiet(true);
31 InspectorTest.runDebuggerTestSuite([
32 function testSimpleMonitor(next)
34 monitorAndRun(next, "simpleTestFunction", "simpleTestFunction();");
37 function testSimpleMonitorWith1Arg(next)
39 monitorAndRun(next, "simpleTestFunction", "simpleTestFunction(1);");
42 function testSimpleMonitorWithManyArgs(next)
44 monitorAndRun(next, "simpleTestFunction", "simpleTestFunction(1, 2, 3, 4 ,5);");
47 function testSimpleUnmonitor(next)
49 InspectorTest.evaluateInConsole("monitor(simpleTestFunction2)");
50 InspectorTest.evaluateInConsole("unmonitor(simpleTestFunction2)");
51 monitorAndRun(next, "simpleTestFunction3", "simpleTestFunction2();");
54 function testUnmonitorFuntionNotMonitored(next)
56 InspectorTest.evaluateInConsole("monitor(simpleTestFunction)", next);
58 ]);
60 function monitorAndRun(next, functionName, runCmd)
62 InspectorTest.evaluateInConsole("monitor(" + functionName + ")");
63 InspectorTest.addResult("Start monitoring function.");
65 InspectorTest.evaluateInConsole("setTimeout(function() { " + runCmd + " }, 0)");
66 InspectorTest.addResult("Set timer for test function.");
67 InspectorTest.waitUntilMessageReceived(didReceive);
69 function didReceive(message)
71 if (message.type === WebInspector.ConsoleMessage.MessageType.Result) {
72 InspectorTest.waitUntilMessageReceived(didReceive);
73 return;
76 InspectorTest.addResult("Console message received: " + message.messageText);
77 InspectorTest.evaluateInConsole("unmonitor(" + functionName + ")");
78 InspectorTest.addResult("Stop monitoring.");
79 next();
84 </script>
85 </head>
87 <body onload="runTest()">
88 <p>
89 Tests traceCalls(fn) console command.
90 </p>
92 </body>
93 </html>