mirror of
https://github.com/servo/servo.git
synced 2025-09-03 03:28:20 +01:00
Update web-platform-tests to revision 4052654d786236b493d2df3cb80b9d3d1d0a8354
This commit is contained in:
parent
eab848df3e
commit
3b6ddd885a
116 changed files with 4255 additions and 821 deletions
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<meta charset=utf-8 />
|
||||
<title>Event Timing: buffer long-latency events before onload</title>
|
||||
<button id='button' onclick='clickDelay()'>Generate a 'click' event</button>
|
||||
<button id='button' onmousedown='clickDelay()'>Generate a 'click' event</button>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<script src=/resources/testdriver.js></script>
|
||||
|
@ -27,7 +27,7 @@
|
|||
}
|
||||
|
||||
function validateEntries() {
|
||||
const entries = performance.getEntriesByName('click', 'event');
|
||||
const entries = performance.getEntriesByName('mousedown', 'event');
|
||||
|
||||
const entriesBeforeOnload = entries.filter(
|
||||
e => e.startTime < onloadStart);
|
||||
|
@ -69,7 +69,8 @@
|
|||
const observerPromise = new Promise((resolve, reject) => {
|
||||
let entryCount = 0;
|
||||
new PerformanceObserver(entryList => {
|
||||
entryCount += entryList.getEntries().length;
|
||||
entryCount += entryList.getEntries().filter(
|
||||
entry => entry.name === 'mousedown').length;
|
||||
if (entryCount >= 2)
|
||||
resolve();
|
||||
}).observe({ entryTypes: ['event'] });
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</head>
|
||||
|
||||
<body>
|
||||
<button id='button' onclick='1'>Generate a 'click' event</button>
|
||||
<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>
|
||||
|
@ -22,7 +22,7 @@
|
|||
let onloadStart;
|
||||
|
||||
function validateEntries() {
|
||||
const entries = performance.getEntriesByName('click', 'event');
|
||||
const entries = performance.getEntriesByName('mousedown', 'event');
|
||||
|
||||
assert_equals(entries.length, 1,
|
||||
"Observer of main frames should only capture main-frame event-timing entries."
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<meta charset=utf-8 />
|
||||
<title>Event Timing: Performance observers can observe long-latency events
|
||||
</title>
|
||||
<button id='button' onclick='1'>Generate a 'click' event</button>
|
||||
<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>
|
||||
|
@ -77,7 +77,8 @@
|
|||
async_test(function(t) {
|
||||
const observerPromise = new Promise((resolve, reject) => {
|
||||
new PerformanceObserver(function(entryList) {
|
||||
observedEntries = observedEntries.concat(entryList.getEntries());
|
||||
observedEntries = observedEntries.concat(entryList.getEntries().filter(
|
||||
entry => entry.name === 'mousedown'));
|
||||
if (observedEntries.length < 2) return;
|
||||
resolve(observedEntries);
|
||||
}).observe({ entryTypes: ['event'] });
|
||||
|
@ -93,7 +94,7 @@
|
|||
Promise.all([observerPromise, bufferPromise]).then((results) => {
|
||||
timeAfterSecondClick = performance.now();
|
||||
t.step(verifyObserverEntries.bind(null, results[0]));
|
||||
t.step(verifyBuffer.bind(null, performance.getEntriesByName('click', 'event')));
|
||||
t.step(verifyBuffer.bind(null, performance.getEntriesByName('mousedown', 'event')));
|
||||
t.done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<meta charset=utf-8 />
|
||||
<title>Event Timing: buffer long-latency events before onload</title>
|
||||
<button id='button' onclick='1'>Generate a 'click' event</button>
|
||||
<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>
|
||||
|
@ -23,7 +23,8 @@
|
|||
let numFirstInputObserved = 0;
|
||||
let numEventsObserved = 0;
|
||||
new PerformanceObserver(t.step_func((entryList, obs) => {
|
||||
const observedEntries = entryList.getEntries();
|
||||
const observedEntries = entryList.getEntries().filter(
|
||||
entry => entry.name === 'mousedown');
|
||||
numEventsObserved += observedEntries.filter(entry =>
|
||||
entry.entryType == 'event').length;
|
||||
numFirstInputObserved += observedEntries.filter(entry =>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<title>Event Timing: long-latency events after onload and before observer
|
||||
registration are lost
|
||||
</title>
|
||||
<button id='button' onclick='1'>Generate a 'click' event</button>
|
||||
<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>
|
||||
|
@ -18,7 +18,7 @@ registration are lost
|
|||
|
||||
function verifyBufferAndObserverEntries(observedEntries) {
|
||||
// Verify buffer entries
|
||||
const bufferedEntries = performance.getEntriesByName('click', 'event');
|
||||
const bufferedEntries = performance.getEntriesByName('mousedown', 'event');
|
||||
const bufferedEntriesBeforeObserver = bufferedEntries.filter(e => e.startTime <
|
||||
observerStart);
|
||||
assert_equals(bufferedEntries.length, 0,
|
||||
|
@ -42,7 +42,8 @@ registration are lost
|
|||
function startObserver(t) {
|
||||
new PerformanceObserver(t.step_func_done((entryList, obs) => {
|
||||
callbackTime = performance.now();
|
||||
const observedEntries = entryList.getEntries();
|
||||
const observedEntries = entryList.getEntries().filter(
|
||||
entry => entry.name === 'mousedown');
|
||||
verifyBufferAndObserverEntries(observedEntries);
|
||||
})).observe({ entryTypes: ['event'] });
|
||||
observerStart = performance.now();
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<meta charset=utf-8 />
|
||||
<title>Event Timing: only observe the first input</title>
|
||||
<button id='button' onclick='1'>Generate a 'click' event</button>
|
||||
<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>
|
||||
|
@ -24,10 +24,11 @@
|
|||
new PerformanceObserver(t.step_func((entryList) => {
|
||||
assert_false(hasObservedFirstInput);
|
||||
hasObservedFirstInput = true;
|
||||
const observedEntries = entryList.getEntries();
|
||||
const observedEntries = entryList.getEntries().filter(
|
||||
entry => entry.name === 'mousedown');
|
||||
assert_equals(observedEntries.length, 1);
|
||||
assert_equals(observedEntries[0].entryType, 'firstInput');
|
||||
assert_equals(observedEntries[0].name, 'click');
|
||||
assert_equals(observedEntries[0].name, 'mousedown');
|
||||
})).observe({ entryTypes: ['firstInput'] });
|
||||
on_event(window, 'load', () => {
|
||||
clickAndBlockMain('button').then(() => {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<html>
|
||||
<meta charset=utf-8>
|
||||
<title>Event Timing: make sure event-timing entries are retrievable by existing perf APIs.</title>
|
||||
<button id='button' onclick='1'>Generate a 'click' event</button>
|
||||
<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>
|
||||
|
@ -13,7 +13,7 @@
|
|||
|
||||
<script>
|
||||
function validateEntries() {
|
||||
const entriesByName = performance.getEntriesByName('click', 'event');
|
||||
const entriesByName = performance.getEntriesByName('mousedown', 'event');
|
||||
const entriesByType = performance.getEntriesByType('event');
|
||||
const allEntries = performance.getEntries();
|
||||
assert_equals(entriesByName.length, 1, 'event-timing entry should be retrievable by getEntriesByName');
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
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.name, 'mousedown');
|
||||
assert_equals(entry.entryType, 'firstInput');
|
||||
assert_greater_than(entry.duration, 50,
|
||||
"The first input was a long one.");
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<meta charset=utf-8 />
|
||||
<title>Event Timing only times certain types of trusted event.
|
||||
</title>
|
||||
<button id='button' onclick='mainThreadBusy(60)'
|
||||
<button id='button' onmousedown='mainThreadBusy(60)'
|
||||
onfocus='mainThreadBusy(60)'>Generate a 'click' event</button>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
|
@ -23,7 +23,7 @@
|
|||
function untrustedClickAndBlockMain(id) {
|
||||
const target = document.getElementById(id);
|
||||
// Block mainthread in the callback, as dispatchEvent() is a sync call.
|
||||
target.dispatchEvent(new MouseEvent('click'));
|
||||
target.dispatchEvent(new MouseEvent('mousedown'));
|
||||
}
|
||||
|
||||
function trustedFocusAndBlockMain(id) {
|
||||
|
@ -36,11 +36,12 @@
|
|||
async_test(function(t) {
|
||||
new PerformanceObserver(t.step_func_done(entryList => {
|
||||
const observerCallbackTime = performance.now();
|
||||
const entries = entryList.getEntries();
|
||||
const entries = entryList.getEntries().filter(
|
||||
entry => entry.name === 'mousedown');
|
||||
assert_equals(entries.length, 1,
|
||||
"Should only observe one entry: " +
|
||||
JSON.stringify(entries) + ".");
|
||||
assert_equals(entries[0].name, 'click',
|
||||
assert_equals(entries[0].name, 'mousedown',
|
||||
"The observed entry should be a click");
|
||||
assert_less_than(entries[0].startTime, observerCallbackTime,
|
||||
"The startTime should be before observerCallbackTime");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<!DOCType html>
|
||||
<html>
|
||||
<script src=event-timing-support.js></script>
|
||||
<button id='button_child_frame' onclick='2'>Generate a 'click' event</button>
|
||||
<button id='button_child_frame'>Generate a 'click' event</button>
|
||||
<img src=slow-image.py>
|
||||
<script>
|
||||
const clickTimeMin = performance.now();
|
||||
|
@ -9,7 +9,7 @@
|
|||
const processingStartMin = performance.now();
|
||||
const observerPromise = new Promise((resolve, reject) => {
|
||||
new PerformanceObserver((entryList) => {
|
||||
resolve(entryList.getEntries());
|
||||
resolve(entryList.getEntries().filter(entry => entry.name === 'mousedown'));
|
||||
}).observe({ entryTypes: ['event'] });
|
||||
});
|
||||
window.addEventListener('load', e => {
|
||||
|
|
|
@ -11,9 +11,9 @@ function clickOnElement(id, callback) {
|
|||
mainThreadBusy(60);
|
||||
if (callback)
|
||||
callback();
|
||||
element.removeEventListener("click", clickHandler);
|
||||
element.removeEventListener("mousedown", clickHandler);
|
||||
};
|
||||
element.addEventListener("click", clickHandler);
|
||||
element.addEventListener("mousedown", clickHandler);
|
||||
test_driver.click(element);
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ function mainThreadBusy(duration) {
|
|||
// the timings of the 'firstInput' entry should be equal to those of this entry.
|
||||
function verifyClickEvent(entry, is_first=false) {
|
||||
assert_true(entry.cancelable);
|
||||
assert_equals(entry.name, 'click');
|
||||
assert_equals(entry.name, 'mousedown');
|
||||
assert_equals(entry.entryType, 'event');
|
||||
assert_greater_than(entry.duration, 50,
|
||||
"The entry's duration should be greater than 50ms.");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue