Commit 223d6ec0 authored by Nicolás Peña Moreno's avatar Nicolás Peña Moreno Committed by Commit Bot

Reland "[EventTiming] Fix programmatic click test"

This is a reland of 3bd9684c

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 aee8357d and
> faed29aa 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/+/1610022Reviewed-by: default avatarLiquan (Max) Gu <maxlg@chromium.org>
Commit-Queue: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659680}
parent 066e9b88
...@@ -5562,9 +5562,6 @@ crbug.com/959129 [ Win Linux ] http/tests/devtools/tracing/timeline-script-parse ...@@ -5562,9 +5562,6 @@ crbug.com/959129 [ Win Linux ] http/tests/devtools/tracing/timeline-script-parse
# Sheriff 2019-05-07 # Sheriff 2019-05-07
crbug.com/960443 [ Mac10.10 Mac10.11 ] external/wpt/animation-worklet/worklet-animation-with-scroll-timeline.https.html [ Failure Pass ] crbug.com/960443 [ Mac10.10 Mac10.11 ] external/wpt/animation-worklet/worklet-animation-with-scroll-timeline.https.html [ Failure Pass ]
# Sheriff 2019-05-07
crbug.com/961547 external/wpt/event-timing/programmatic-click-not-observed.html [ Pass Failure ]
# Sheriff 2019-05-10 # Sheriff 2019-05-10
crbug.com/960623 [ Win ] http/tests/misc/resource-timing-sizes-multipart.html [ Pass Failure ] crbug.com/960623 [ Win ] http/tests/misc/resource-timing-sizes-multipart.html [ Pass Failure ]
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<script src=/resources/testdriver.js></script> <script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.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> <script>
let delayCalled = false; let delayCalled = false;
let beforeClick; let beforeClick;
...@@ -19,15 +19,19 @@ ...@@ -19,15 +19,19 @@
} }
async_test(function(t) { async_test(function(t) {
const observer = new PerformanceObserver(t.step_func_done((entryList) => { 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. // There must only be one click entry: from the clickAndBlockMain() call.
assert_equals(entries.length, 1); assert_equals(entries.length, 1);
const entry = entries[0]; const entry = entries[0];
// This ensures that the entry is exposing timing from the second click, i.e. // This ensures that the entry is exposing timing from the second click, i.e.
// the one from the clickAndBlockMain() call. // the one from the clickAndBlockMain() call.
assert_greater_than_equal(entry.processingStart, beforeClick); 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(); document.getElementById('div').click();
// Take the timestamp after the programmatic click but before the next click. // Take the timestamp after the programmatic click but before the next click.
beforeClick = performance.now(); beforeClick = performance.now();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment