3 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/inspector-protocol-test.js"></script>
4 <script type=
"text/javascript" src=
"../../http/tests/inspector-protocol/tracing-test.js"></script>
7 function performAction(callback
)
9 var div
= document
.querySelector("#my-div");
10 div
.addEventListener("click", function(e
) { }, false);
13 var iframe
= document
.createElement("iframe");
14 div
.appendChild(iframe
);
20 InspectorTest
.invokeAsyncWithTracing("performAction", finish
);
22 function finish(devtoolsEvents
)
24 function windowEventFilter(type
, e
)
26 return e
.name
=== "EventDispatch" && e
.args
.data
.type
=== type
;
29 var windowEventNames
= [ "click", "beforeunload", "unload", "load" ];
30 for (var i
= 0; i
< windowEventNames
.length
; i
++) {
31 var eventName
= windowEventNames
[i
];
32 var events
= devtoolsEvents
.filter(windowEventFilter
.bind(this, eventName
));
33 if (events
.length
>= 1) {
34 InspectorTest
.log("SUCCESS: found " + eventName
+ " event");
36 fail(eventName
+ " event is missing", devtoolsEvents
);
40 InspectorTest
.completeTest();
43 function fail(message
, devtoolsEvents
)
45 var formattedEvents
= devtoolsEvents
.map(function(e
)
47 return e
.name
+ (e
.args
.data
? "(" + e
.args
.data
.type
+ ")" : "");
49 InspectorTest
.log("FAIL: " + message
+ " devtools.timeline events: " + JSON
.stringify(formattedEvents
, null, 2));
54 <body onLoad=
"runTest();">
55 <div id=
"my-div"></div>