mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
Update web-platform-tests to revision b8669365b81965f5400d6b13a7783415b44e679d
This commit is contained in:
parent
6fa1853bb1
commit
bde105ca2e
42 changed files with 933 additions and 241 deletions
|
@ -0,0 +1,30 @@
|
|||
// Compares a list of performance entries to a predefined one.
|
||||
// actualEntries is an array of performance entries from the user agent,
|
||||
// and expectedEntries is an array of performance entries minted by the test.
|
||||
// The comparison doesn't assert the order of the entries.
|
||||
function checkEntries(actualEntries, expectedEntries) {
|
||||
assert_equals(actualEntries.length, expectedEntries.length,
|
||||
`The length of actual and expected entries should match.
|
||||
actual: ${JSON.stringify(actualEntries)},
|
||||
expected: ${JSON.stringify(expectedEntries)}`);
|
||||
const actualEntrySet = new Set(actualEntries.map(ae=>ae.name));
|
||||
assert_equals(actualEntrySet.size, actualEntries.length, `Actual entry names are not unique: ${JSON.stringify(actualEntries)}`);
|
||||
const expectedEntrySet = new Set(expectedEntries.map(ee=>ee.name));
|
||||
assert_equals(expectedEntrySet.size, expectedEntries.length, `Expected entry names are not unique: ${JSON.stringify(expectedEntries)}`);
|
||||
actualEntries.forEach(ae=>{
|
||||
const expectedEntry = expectedEntries.find(e=>e.name === ae.name);
|
||||
assert_true(!!expectedEntry, `Entry name '${ae.name}' was not found.`);
|
||||
checkEntry(ae, expectedEntry);
|
||||
});
|
||||
}
|
||||
|
||||
function checkEntry(entry, {name, entryType, startTime, detail, duration}) {
|
||||
assert_equals(entry.name, name);
|
||||
assert_equals(entry.entryType, entryType);
|
||||
if (startTime !== undefined)
|
||||
assert_equals(entry.startTime, startTime);
|
||||
if (detail !== undefined)
|
||||
assert_equals(JSON.stringify(entry.detail), JSON.stringify(detail));
|
||||
if (duration !== undefined)
|
||||
assert_equals(entry.duration, duration);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue