Bug 1638100 [wpt PR 23608] - [EventTiming] Wrap lines better in event-timing-test-utils, a=testonly

Automatic update from web-platform-tests
[EventTiming] Wrap lines better in event-timing-test-utils (#23608)

This CL addresses a forgotten nit from
https://chromium-review.googlesource.com/c/chromium/src/+/2191238/2/third_party/blink/web_tests/external/wpt/event-timing/resources/event-timing-test-utils.js#125

Change-Id: Ibf5d168d912294b1a5df4099c4d8c269ae505a91
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2199689
Auto-Submit: Nicolás Peña Moreno <npm@chromium.org>
Reviewed-by: Yoav Weiss <yoavweiss@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Commit-Queue: Yoav Weiss <yoavweiss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#768514}

Co-authored-by: Nicolás Peña Moreno <npm@chromium.org>
--

wpt-commits: 05857b50e116d5292265edb6624960bc5b31307a
wpt-pr: 23608
This commit is contained in:
Blink WPT Bot 2020-05-21 10:22:06 +00:00 коммит произвёл moz-wptsync-bot
Родитель 301c73e51a
Коммит 7532ecf020
1 изменённых файлов: 23 добавлений и 11 удалений

Просмотреть файл

@ -122,9 +122,9 @@ async function testDuration(t, id, numEntries, dur, fastDur, slowDur) {
return Promise.all([observerPromise, clicksPromise]);
}
// Apply events that trigger an event of the given |eventType| to be dispatched to the |target|. Some
// of these assume that the target is not on the top left corner of the screen, which means that
// (0, 0) of the viewport is outside of the |target|.
// Apply events that trigger an event of the given |eventType| to be dispatched to the
// |target|. Some of these assume that the target is not on the top left corner of the
// screen, which means that (0, 0) of the viewport is outside of the |target|.
function applyAction(eventType, target) {
const actions = new test_driver.Actions();
if (eventType === 'auxclick') {
@ -167,16 +167,25 @@ function applyAction(eventType, target) {
}
function requiresListener(eventType) {
return ['mouseenter', 'mouseleave', 'pointerdown', 'pointerenter', 'pointerleave', 'pointerout', 'pointerover', 'pointerup'].includes(eventType);
return ['mouseenter',
'mouseleave',
'pointerdown',
'pointerenter',
'pointerleave',
'pointerout',
'pointerover',
'pointerup'
].includes(eventType);
}
function notCancelable(eventType) {
return ['mouseenter', 'mouseleave', 'pointerenter', 'pointerleave'].includes(eventType);
}
// Tests the given |eventType| by creating events whose target are the element with id 'target'.
// The test assumes that such element already exists. |looseCount| is set for events for which
// events would occur for other elements besides the target, so the counts will be larger.
// Tests the given |eventType| by creating events whose target are the element with id
// 'target'. The test assumes that such element already exists. |looseCount| is set for
// eventTypes for which events would occur for other elements besides the target, so the
// counts will be larger.
async function testEventType(t, eventType, looseCount=false) {
assert_implements(window.EventCounts, "Event Counts isn't supported");
assert_equals(performance.eventCounts.get(eventType), 0);
@ -192,7 +201,8 @@ async function testEventType(t, eventType, looseCount=false) {
assert_greater_than_equal(performance.eventCounts.get(eventType), 2,
`Should have at least 2 ${eventType} events`)
} else {
assert_equals(performance.eventCounts.get(eventType), 2, `Should have 2 ${eventType} events`);
assert_equals(performance.eventCounts.get(eventType), 2,
`Should have 2 ${eventType} events`);
}
// The durationThreshold used by the observer. A slow events needs to be slower than that.
const durationThreshold = 16;
@ -211,7 +221,8 @@ async function testEventType(t, eventType, looseCount=false) {
entry = eventTypeEntries[0];
assert_equals(eventTypeEntries.length, 1);
} else {
// The other events could also be considered slow. Find the one with the correct target.
// The other events could also be considered slow. Find the one with the correct
// target.
eventTypeEntries.forEach(e => {
if (e.target === document.getElementById('target'))
entry = e;
@ -229,7 +240,8 @@ async function testEventType(t, eventType, looseCount=false) {
assert_greater_than_equal(performance.eventCounts.get(eventType), 3,
`Should have at least 3 ${eventType} events`)
} else {
assert_equals(performance.eventCounts.get(eventType), 3, `Should have 3 ${eventType} events`);
assert_equals(performance.eventCounts.get(eventType), 3,
`Should have 3 ${eventType} events`);
}
resolve();
})).observe({type: 'event', durationThreshold: durationThreshold});
@ -237,4 +249,4 @@ async function testEventType(t, eventType, looseCount=false) {
// Cause a slow event.
let actionPromise = applyAction(eventType, target);
return Promise.all([actionPromise, observerPromise]);
}
}