Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector-protocol/timeline/timeline-dispatchEvent.js

Issue 2942573003: [DevTools] New harness for inspector-protocol layout tests (Closed)
Patch Set: Protocol -> dp Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 (async function(testRunner) {
2 let {page, session, dp} = await testRunner.startHTML(`
3 <div id='my-div'></div>
4 `, '');
5
6 function performAction() {
7 var div = document.querySelector('#my-div');
8 div.addEventListener('click', function(e) { }, false);
9 div.click();
10
11 var iframe = document.createElement('iframe');
12 div.appendChild(iframe);
13 return new Promise(resolve => {
14 iframe.onload = resolve;
15 iframe.src = 'blank.html';
16 });
17 }
18
19 var tracingHelper = (await testRunner.loadScript('../resources/tracing-test.js '))(testRunner, session);
20 await session.evaluate(performAction.toString());
21 tracingHelper.invokeAsyncWithTracing('performAction', finish);
22
23 function finish(devtoolsEvents) {
24 function windowEventFilter(type, e) {
25 return e.name === 'EventDispatch' && e.args.data.type === type;
26 };
27
28 var windowEventNames = [ 'click', 'beforeunload', 'unload', 'load' ];
29 for (var i = 0; i < windowEventNames.length; i++) {
30 var eventName = windowEventNames[i];
31 var events = devtoolsEvents.filter(windowEventFilter.bind(this, eventName) );
32 if (events.length >= 1)
33 testRunner.log('SUCCESS: found ' + eventName + ' event');
34 else
35 fail(eventName + ' event is missing', devtoolsEvents);
36 }
37
38 testRunner.completeTest();
39 }
40
41 function fail(message, devtoolsEvents) {
42 var formattedEvents = devtoolsEvents.map(function(e) {
43 return e.name + (e.args.data ? '(' + e.args.data.type + ')' : '');
44 });
45 testRunner.log('FAIL: ' + message + ' devtools.timeline events: ' + JSON.str ingify(formattedEvents, null, 2));
46 }
47 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698