blob: a420eb16e2199c094e649198a93f33a5e2540c04 [file] [log] [blame]
<html>
<head>
<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
<script>
function testFunction()
{
setTimeout(hotFunction, 0);
}
var terminated = false;
function hotFunction() {
evaluateInFrontend("InspectorTest.didFireTimer()");
var message_id = 1;
var ts = Date.now();
while (!terminated) {
// Without this try/catch v8 will optimize the function and break will not work.
try {
if (Date.now() - ts > 1000) {
ts = Date.now();
console.error("Message #" + message_id++);
}
} catch (e) {
}
}
}
function test()
{
InspectorTest.sendCommand("Inspector.enable", {});
InspectorTest.sendCommand("Debugger.enable", {}, didEnableDebugger);
function didEnableDebugger()
{
// Start tight loop in page.
InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunction()" }, didEval);
function didEval()
{
InspectorTest.log("didEval");
}
}
InspectorTest.didFireTimer = function()
{
InspectorTest.log("didFireTimer");
InspectorTest.sendCommand("Debugger.pause", { });
}
InspectorTest.eventHandler["Debugger.paused"] = function(messageObject)
{
var message = messageObject["params"]["message"];
InspectorTest.log("SUCCESS: Paused");
InspectorTest.sendCommand("Runtime.evaluate", { "expression": "terminated = true;" });
InspectorTest.sendCommand("Debugger.resume", { });
InspectorTest.completeTest();
}
}
</script>
</head>
<body onLoad="runTest();">
</body>
</html>