| Index: third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.js
|
| diff --git a/third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.js b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..890af8524718ca7e1ceea925d5d9dc466c1ad9da
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.js
|
| @@ -0,0 +1,47 @@
|
| +(async function(testRunner) {
|
| + let {page, session, dp} = await testRunner.startHTML(`
|
| + <div id='my-div'></div>
|
| + `, '');
|
| +
|
| + function performAction() {
|
| + var div = document.querySelector('#my-div');
|
| + div.addEventListener('click', function(e) { }, false);
|
| + div.click();
|
| +
|
| + var iframe = document.createElement('iframe');
|
| + div.appendChild(iframe);
|
| + return new Promise(resolve => {
|
| + iframe.onload = resolve;
|
| + iframe.src = 'blank.html';
|
| + });
|
| + }
|
| +
|
| + var tracingHelper = (await testRunner.loadScript('../resources/tracing-test.js'))(testRunner, session);
|
| + await session.evaluate(performAction.toString());
|
| + tracingHelper.invokeAsyncWithTracing('performAction', finish);
|
| +
|
| + function finish(devtoolsEvents) {
|
| + function windowEventFilter(type, e) {
|
| + return e.name === 'EventDispatch' && e.args.data.type === type;
|
| + };
|
| +
|
| + var windowEventNames = [ 'click', 'beforeunload', 'unload', 'load' ];
|
| + for (var i = 0; i < windowEventNames.length; i++) {
|
| + var eventName = windowEventNames[i];
|
| + var events = devtoolsEvents.filter(windowEventFilter.bind(this, eventName));
|
| + if (events.length >= 1)
|
| + testRunner.log('SUCCESS: found ' + eventName + ' event');
|
| + else
|
| + fail(eventName + ' event is missing', devtoolsEvents);
|
| + }
|
| +
|
| + testRunner.completeTest();
|
| + }
|
| +
|
| + function fail(message, devtoolsEvents) {
|
| + var formattedEvents = devtoolsEvents.map(function(e) {
|
| + return e.name + (e.args.data ? '(' + e.args.data.type + ')' : '');
|
| + });
|
| + testRunner.log('FAIL: ' + message + ' devtools.timeline events: ' + JSON.stringify(formattedEvents, null, 2));
|
| + }
|
| +})
|
|
|