| Index: LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html
|
| diff --git a/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html b/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9a9a85462d55a8bb9665a6a5ab9304e9fe9b6f66
|
| --- /dev/null
|
| +++ b/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.html
|
| @@ -0,0 +1,96 @@
|
| +<html>
|
| +<head>
|
| +<script type="text/javascript" src="../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
|
| +<script>
|
| +
|
| +function testFunction()
|
| +{
|
| + var div = document.querySelector("#my-div");
|
| + div.addEventListener("click", function(e) { }, false);
|
| + div.click();
|
| +
|
| + var iframe = document.createElement("iframe");
|
| + div.appendChild(iframe);
|
| +}
|
| +
|
| +function test()
|
| +{
|
| + InspectorTest.eventHandler["Tracing.dataCollected"] = dataCollected;
|
| + InspectorTest.eventHandler["Tracing.tracingComplete"] = tracingComplete;
|
| + InspectorTest.sendCommand("Tracing.start", { "categories" : "disabled-by-default-devtools-timeline", "type": "" }, onStart);
|
| +
|
| + function onStart(response)
|
| + {
|
| + InspectorTest.log("Recording started");
|
| + InspectorTest.sendCommand("Runtime.evaluate", { "expression": "testFunction()" }, didEvaluate);
|
| + }
|
| +
|
| + function didEvaluate(response)
|
| + {
|
| + InspectorTest.sendCommand("Tracing.end", { }, onStop);
|
| + }
|
| +
|
| + var devtoolsEvents = [];
|
| + function dataCollected(reply)
|
| + {
|
| + var allEvents = reply.params.value;
|
| + devtoolsEvents = devtoolsEvents.concat(allEvents.filter(function(e)
|
| + {
|
| + return e.cat === "disabled-by-default-devtools-timeline";
|
| + }));
|
| + }
|
| +
|
| + function tracingComplete(event)
|
| + {
|
| + InspectorTest.log("Tracing complete");
|
| +
|
| + var clickEvents = devtoolsEvents.filter(function(e)
|
| + {
|
| + return e.name === "EventDispatcher::dispatch" && e.args.type === "click";
|
| + });
|
| + if (clickEvents.length === 1) {
|
| + InspectorTest.log("SUCCESS: found click event");
|
| + } else {
|
| + fail("click event is missing");
|
| + }
|
| +
|
| + function windowEventFilter(type, e)
|
| + {
|
| + return e.name === "DOMWindow::dispatchEvent" && e.args.type === type;
|
| + };
|
| +
|
| + var windowEventNames = [ "beforeunload", "unload", "load" ];
|
| + for (var i = 0; i < windowEventNames.length; i++) {
|
| + var eventName = windowEventNames[i];
|
| + var events = devtoolsEvents.filter(windowEventFilter.bind(this, eventName));
|
| + if (clickEvents.length === 1) {
|
| + InspectorTest.log("SUCCESS: found one " + eventName + " event");
|
| + } else {
|
| + fail(eventName + " event is missing");
|
| + }
|
| + }
|
| +
|
| + InspectorTest.completeTest();
|
| + }
|
| +
|
| +
|
| + function fail(message)
|
| + {
|
| + var formattedEvents = devtoolsEvents.map(function(e)
|
| + {
|
| + return e.name + "(" + e.args.type + ")";
|
| + });
|
| + InspectorTest.log("FAIL: " + message + " devtools-timeline events: " + JSON.stringify(formattedEvents, null, 2));
|
| + }
|
| +
|
| + function onStop(response)
|
| + {
|
| + InspectorTest.log("Recording stopped");
|
| + }
|
| +}
|
| +</script>
|
| +</head>
|
| +<body onLoad="runTest();">
|
| +<div id="my-div"></div>
|
| +</body>
|
| +</html>
|
|
|