Update web-platform-tests to revision 0b22439430b6d8d9a6d43a0908e86c0366f207c0

This commit is contained in:
WPT Sync Bot 2019-07-06 10:25:38 +00:00
parent 39ec04a065
commit c8e806d0ef
93 changed files with 2118 additions and 597 deletions

View file

@ -27,9 +27,7 @@
firstClickEnd = performance.now();
}
function validateEntries() {
const entries = performance.getEntriesByName('mousedown', 'event');
function validateEntries(entries) {
const entriesBeforeOnload = entries.filter(
e => e.startTime < onloadStart);
assert_equals(entriesBeforeOnload.length, 1,
@ -48,8 +46,8 @@
const entriesAfterOnload = entries.filter(
e => e.startTime >= onloadStart);
assert_equals(entriesAfterOnload.length, 0,
"Events after onload shouldn't be buffered.");
assert_equals(entriesAfterOnload.length, 1,
"Events after onload should still be buffered.");
}
/* Timeline:
@ -66,24 +64,31 @@
async_test(function(t) {
clickTimeMin = performance.now();
clickAndBlockMain('button');
// Use a dummy observer to know when both clicks have been dispatched.
const observerPromise = new Promise((resolve, reject) => {
let entryCount = 0;
new PerformanceObserver(entryList => {
entryCount += entryList.getEntries().filter(
entry => entry.name === 'mousedown').length;
if (entryCount >= 2)
resolve();
}).observe({ entryTypes: ['event'] });
});
// Event handlers will be dispatched asynchronously, so this will be called
// before processing begins.
processingStartMin = performance.now();
const bufferedEntries = [];
on_event(window, 'load', e => {
onloadStart = performance.now();
const clickPromise = clickAndBlockMain('button');
Promise.all([observerPromise, clickPromise]).then(
t.step_func_done(validateEntries));
// Register the observer after the page has been loaded
const observer = new PerformanceObserver(function (entryList, observer) {
entryList.getEntries().forEach(function(entry) {
assert_equals(entry.entryType, "event");
if (entry.name === 'mousedown') {
bufferedEntries.push(entry);
}
if (bufferedEntries.length == 2) {
validateEntries(bufferedEntries)
observer.disconnect();
t.done();
}
});
})
observer.observe({
type: "event",
buffered: true
});
clickAndBlockMain('button');
});
}, "Event Timing: click, onload.");