mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Update web-platform-tests to revision 093a97b6ecc6484c201d704d38b47bef1964d59d
This commit is contained in:
parent
16e4eb6964
commit
f9972c83e3
79 changed files with 1530 additions and 824 deletions
|
@ -65,12 +65,22 @@
|
|||
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().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();
|
||||
on_event(window, 'load', e => {
|
||||
onloadStart = performance.now();
|
||||
clickAndBlockMain('button').then(wait).then(
|
||||
const clickPromise = clickAndBlockMain('button');
|
||||
Promise.all([observerPromise, clickPromise]).then(
|
||||
t.step_func_done(validateEntries));
|
||||
});
|
||||
}, "Event Timing: click, onload.");
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
if (numEventsObserved >= 2) {
|
||||
assert_equals(performance.getEntriesByType('event').length, 0,
|
||||
"There should be no buffered event entries.");
|
||||
assert_equals(performance.getEntriesByType('firstInput').length, 0,
|
||||
"There should be no buffered firstInput entries.");
|
||||
assert_equals(performance.getEntriesByType('firstInput').length, 1,
|
||||
"There should be a buffered firstInput entry.");
|
||||
// There should be 2 event entries and one firstInput entry.
|
||||
assert_equals(numEventsObserved, 2,
|
||||
"There should be 2 observed event entries.");
|
||||
|
@ -42,8 +42,8 @@
|
|||
}
|
||||
})).observe({ entryTypes: ['event', 'firstInput'] });
|
||||
on_event(window, 'load', () => {
|
||||
clickAndBlockMain('button').then(wait).then(() => {
|
||||
clickAndBlockMain('button').then(wait);
|
||||
clickAndBlockMain('button').then(() => {
|
||||
clickAndBlockMain('button');
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -61,16 +61,22 @@ registration are lost
|
|||
(Dispatch and Process Click 2 (not buffered, observed))
|
||||
*/
|
||||
async_test(function(t) {
|
||||
on_event(window, 'load', () => {
|
||||
clickAndBlockMain('button').then(() => {
|
||||
startObserver(t);
|
||||
clickAndBlockMain('button').then(wait);
|
||||
processingStartMin = performance.now();
|
||||
});
|
||||
// Use a dummy observer to know when the first click has been dispatched.
|
||||
const observerPromise = new Promise((resolve, reject) => {
|
||||
new PerformanceObserver((entryList, observer) => {
|
||||
resolve();
|
||||
observer.disconnect();
|
||||
}).observe({ entryTypes: ['event'] });
|
||||
});
|
||||
on_event(window, 'load', () => {
|
||||
const clickPromise = clickAndBlockMain('button');
|
||||
Promise.all([observerPromise, clickPromise]).then(() => {
|
||||
startObserver(t);
|
||||
clickAndBlockMain('button');
|
||||
processingStartMin = performance.now();
|
||||
});
|
||||
},
|
||||
"Event Timing: onload, click, observer, click."
|
||||
);
|
||||
});
|
||||
},"Event Timing: onload, click, observer, click.");
|
||||
|
||||
</script>
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset=utf-8 />
|
||||
<title>Event Timing: firstInput entry should be buffered even without observer</title>
|
||||
<button id='button'>Generate a 'click' event</button>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/testdriver.js></script>
|
||||
<script src=/resources/testdriver-vendor.js></script>
|
||||
|
||||
<script src=resources/event-timing-support.js></script>
|
||||
|
||||
<script>
|
||||
async_test(function(t) {
|
||||
function testEntries() {
|
||||
// First callback is not ensured to have the entry.
|
||||
if (performance.getEntriesByType('firstInput').length === 0) {
|
||||
t.step_timeout(testEntries, 10);
|
||||
return;
|
||||
}
|
||||
assert_equals(performance.getEntriesByType('firstInput').length, 1,
|
||||
"There should be a firstInput entry in the performance timeline");
|
||||
const entry = performance.getEntriesByType('firstInput')[0];
|
||||
assert_equals(entry.name, 'click');
|
||||
assert_equals(entry.entryType, 'firstInput');
|
||||
assert_greater_than(entry.duration, 50,
|
||||
"The first input was a long one.");
|
||||
t.done();
|
||||
}
|
||||
clickAndBlockMain('button').then(wait).then(t.step_func(testEntries));
|
||||
},
|
||||
"Event Timing: check firstInput after onload, observer, click, click."
|
||||
);
|
||||
</script>
|
||||
</html>
|
18
tests/wpt/web-platform-tests/event-timing/idlharness.any.js
Normal file
18
tests/wpt/web-platform-tests/event-timing/idlharness.any.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
// META: global=window,worker
|
||||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
// https://wicg.github.io/event-timing/
|
||||
|
||||
'use strict';
|
||||
|
||||
idl_test(
|
||||
['event-timing'],
|
||||
['performance-timeline', 'hr-time', 'dom'],
|
||||
idl_array => {
|
||||
idl_array.add_objects({
|
||||
Performance: ['performance'],
|
||||
// PerformanceEventTiming: [ TODO ]
|
||||
});
|
||||
}
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue