Bug 1551917 [wpt PR 16803] - Reland "[EventTiming] Fix programmatic click test", a=testonly

Automatic update from web-platform-tests
Reland "[EventTiming] Fix programmatic click test"

This is a reland of 3bd9684c7217ec6229e50ff21c4f905855d7c133

The failure was not getting an entry for click:
https://ci.chromium.org/p/chromium/builders/ci/Mac10.13%20Tests/13241

Thus, we instead look at the mousedown. Since mousedown can be the first
input, we stop observing for firstInput but check that entry separately
as well.

Original change's description:
> [EventTiming] Fix programmatic click test
>
> Commits aee8357d3fcb0967069d7f72e2f7fab019d61c4e and
> faed29aa6dc92cbae6e313b401d23df99e973bc1 landed almost at the same time,
> so we accidentally landed a test with the wrong script src for the
> helper functions.
>
> Bug: 961547
> Change-Id: Id8a615477a54e56139d9d90fc4feb5f780b729a2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1606225
> Reviewed-by: Liquan (Max) Gu <maxlg@chromium.org>
> Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#658761}

Bug: 961547
Change-Id: I11f1a5f28e7e4e5ebda28c90555d89669142cc09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1610022
Reviewed-by: Liquan (Max) Gu <maxlg@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659680}

--

wp5At-commits: aa9d7f514022927a797645a8c1db3cd5b90f5826
wpt-pr: 16803
This commit is contained in:
Nicolás Peña Moreno 2019-06-13 10:20:52 +00:00 коммит произвёл James Graham
Родитель ae58b78a55
Коммит b7e4a503a0
1 изменённых файлов: 7 добавлений и 3 удалений

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

@ -8,7 +8,7 @@
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src=resources/event-timing-support.js></script>
<script src=resources/event-timing-test-utils.js></script>
<script>
let delayCalled = false;
let beforeClick;
@ -19,15 +19,19 @@
}
async_test(function(t) {
const observer = new PerformanceObserver(t.step_func_done((entryList) => {
const entries = entryList.getEntries().filter(e => e.name === 'click');
const entries = entryList.getEntries().filter(e => e.name === 'mousedown');
// There must only be one click entry: from the clickAndBlockMain() call.
assert_equals(entries.length, 1);
const entry = entries[0];
// This ensures that the entry is exposing timing from the second click, i.e.
// the one from the clickAndBlockMain() call.
assert_greater_than_equal(entry.processingStart, beforeClick);
// Check that the first input entry was also from the second click.
const firstInput = performance.getEntriesByType('firstInput');
assert_equals(firstInput.length, 1);
assert_greater_than_equal(firstInput[0].processingStart, beforeClick);
}));
observer.observe({entryTypes: ['firstInput', 'event']});
observer.observe({entryTypes: ['event']});
document.getElementById('div').click();
// Take the timestamp after the programmatic click but before the next click.
beforeClick = performance.now();