mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Update web-platform-tests to revision 887d08e63a19b14acf3217df77f12c121a792fed
This commit is contained in:
parent
97ad913dc2
commit
a41065a1f4
65 changed files with 1433 additions and 463 deletions
|
@ -1,51 +1,34 @@
|
|||
// META: script=/resources/WebIDLParser.js
|
||||
// META: script=/resources/idlharness.js
|
||||
|
||||
// https://w3c.github.io/longtask-timing/
|
||||
// https://w3c.github.io/longtasks/
|
||||
|
||||
'use strict';
|
||||
|
||||
promise_test(async t => {
|
||||
const srcs = ['longtasks', 'performance-timeline'];
|
||||
const [idl, perf] = await Promise.all(
|
||||
srcs.map(i => fetch(`/interfaces/${i}.idl`).then(r => r.text())));
|
||||
|
||||
const idl_array = new IdlArray();
|
||||
idl_array.add_idls(idl);
|
||||
idl_array.add_dependency_idls(perf);
|
||||
|
||||
const testIdls = new Promise(resolve => {
|
||||
try {
|
||||
const observer = new PerformanceObserver(entryList => {
|
||||
const entries = Array.from(entryList.getEntries());
|
||||
const attribution = entries.reduce(
|
||||
(sum, e) => sum.concat(e.attribution || []), []);
|
||||
idl_array.add_objects({
|
||||
PerformanceLongTaskTiming: entries,
|
||||
TaskAttributionTiming: attribution,
|
||||
});
|
||||
idl_array.test();
|
||||
resolve();
|
||||
});
|
||||
observer.observe({entryTypes: ['longtask']});
|
||||
} catch (e) {
|
||||
// Will be surfaces in idlharness.js's test_object below.
|
||||
idl_test(
|
||||
['longtasks'],
|
||||
['performance-timeline'],
|
||||
(idl_array, t) => new Promise((resolve, reject) => {
|
||||
const longTask = () => {
|
||||
const begin = self.performance.now();
|
||||
while (self.performance.now() < begin + 100);
|
||||
}
|
||||
});
|
||||
t.step_timeout(longTask, 0);
|
||||
|
||||
const longTask = () => {
|
||||
var begin = self.performance.now();
|
||||
while (self.performance.now() < begin + 100);
|
||||
}
|
||||
t.step_timeout(longTask, 0);
|
||||
const observer = new PerformanceObserver(entryList => {
|
||||
const entries = Array.from(entryList.getEntries());
|
||||
const attribution = entries.reduce(
|
||||
(sum, e) => sum.concat(e.attribution || []), []);
|
||||
idl_array.add_objects({
|
||||
PerformanceLongTaskTiming: entries,
|
||||
TaskAttributionTiming: attribution,
|
||||
});
|
||||
resolve();
|
||||
});
|
||||
observer.observe({entryTypes: ['longtask']});
|
||||
|
||||
const timeout = new Promise(
|
||||
(_, reject) => t.step_timeout(reject, 1000));
|
||||
return Promise.race([testIdls, timeout])
|
||||
.then(
|
||||
t.step_func_done(),
|
||||
() => {
|
||||
idl_array.test(); // Rejected, but test what we can.
|
||||
return Promise.reject('LongTask was not observed');
|
||||
});
|
||||
}, 'longtasks interfaces');
|
||||
t.step_timeout(() => {
|
||||
reject('longtask entry was not observed');
|
||||
}, 1000);
|
||||
})
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue