Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reland "[EventTiming] Fix programmatic click test" #16803

Merged
merged 1 commit into from May 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 7 additions & 3 deletions event-timing/programmatic-click-not-observed.html
Expand Up @@ -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;
Expand All @@ -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();
Expand Down