| OLD | NEW |
| (Empty) |
| 1 <html> | |
| 2 <head> | |
| 3 <script type="text/javascript" src="../../http/tests/inspector-protocol/inspecto
r-protocol-test.js"></script> | |
| 4 <script type="text/javascript" src="../../http/tests/inspector-protocol/tracing-
test.js"></script> | |
| 5 <script> | |
| 6 | |
| 7 function performAction() | |
| 8 { | |
| 9 var div = document.querySelector("#my-div"); | |
| 10 div.addEventListener("click", function(e) { }, false); | |
| 11 div.click(); | |
| 12 | |
| 13 var iframe = document.createElement("iframe"); | |
| 14 div.appendChild(iframe); | |
| 15 return new Promise(resolve => { | |
| 16 iframe.onload = resolve; | |
| 17 iframe.src = "../resources/blank.html"; | |
| 18 }); | |
| 19 } | |
| 20 | |
| 21 function test() | |
| 22 { | |
| 23 InspectorTest.invokeAsyncWithTracing("performAction", finish); | |
| 24 | |
| 25 function finish(devtoolsEvents) | |
| 26 { | |
| 27 function windowEventFilter(type, e) | |
| 28 { | |
| 29 return e.name === "EventDispatch" && e.args.data.type === type; | |
| 30 }; | |
| 31 | |
| 32 var windowEventNames = [ "click", "beforeunload", "unload", "load" ]; | |
| 33 for (var i = 0; i < windowEventNames.length; i++) { | |
| 34 var eventName = windowEventNames[i]; | |
| 35 var events = devtoolsEvents.filter(windowEventFilter.bind(this, even
tName)); | |
| 36 if (events.length >= 1) { | |
| 37 InspectorTest.log("SUCCESS: found " + eventName + " event"); | |
| 38 } else { | |
| 39 fail(eventName + " event is missing", devtoolsEvents); | |
| 40 } | |
| 41 } | |
| 42 | |
| 43 InspectorTest.completeTest(); | |
| 44 } | |
| 45 | |
| 46 function fail(message, devtoolsEvents) | |
| 47 { | |
| 48 var formattedEvents = devtoolsEvents.map(function(e) | |
| 49 { | |
| 50 return e.name + (e.args.data ? "(" + e.args.data.type + ")" : ""); | |
| 51 }); | |
| 52 InspectorTest.log("FAIL: " + message + " devtools.timeline events: " + J
SON.stringify(formattedEvents, null, 2)); | |
| 53 } | |
| 54 } | |
| 55 </script> | |
| 56 </head> | |
| 57 <body onLoad="runTest();"> | |
| 58 <div id="my-div"></div> | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |