mirror of
https://github.com/servo/servo.git
synced 2025-09-01 10:38:25 +01:00
Update web-platform-tests to revision 85e8612e81c8b478c8cac7260436646e48d3f7ae
This commit is contained in:
parent
a14b952fa3
commit
87dcce0f06
66 changed files with 697 additions and 266 deletions
|
@ -53,15 +53,21 @@ let clearAndAddAnotherEntryToBuffer = () => {
|
|||
};
|
||||
|
||||
let testThatEntryWasAdded = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
let waitForIt = function() {
|
||||
if (performance.getEntriesByType("resource").length) {
|
||||
resolve();
|
||||
let tries = 1;
|
||||
let maxTries = 5;
|
||||
return waitUntilConditionIsMet( function() {
|
||||
if (performance.getEntriesByType("resource").length) {
|
||||
return true;
|
||||
} else {
|
||||
if (tries < maxTries) {
|
||||
tries++;
|
||||
return false;
|
||||
} else {
|
||||
reject("After buffer full, entry never added to primary");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
step_timeout(waitForIt, 0);
|
||||
}).then( () => {
|
||||
assert_true((performance.getEntriesByType("resource").length) === 1);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -74,7 +80,6 @@ promise_test(async () => {
|
|||
await clearAndAddAnotherEntryToBuffer();
|
||||
// Since we have no strict guarantees when an entry will be added to the
|
||||
// buffer, waiting till next task to try to avoid flakiness.
|
||||
await waitForNextTask();
|
||||
await testThatEntryWasAdded();
|
||||
}, "Test that entry was added to the buffer after a buffer full event");
|
||||
</script>
|
||||
|
|
|
@ -18,6 +18,19 @@ let waitForNextTask = () => {
|
|||
});
|
||||
};
|
||||
|
||||
let waitUntilConditionIsMet = cond => {
|
||||
return new Promise(resolve => {
|
||||
let checkCondition = function() {
|
||||
if (cond.apply(null)) {
|
||||
resolve();
|
||||
} else {
|
||||
step_timeout(checkCondition.bind(null,cond), 0);
|
||||
}
|
||||
}
|
||||
step_timeout(checkCondition.bind(null, cond), 0);
|
||||
});
|
||||
}
|
||||
|
||||
let waitForEventToFire = () => {
|
||||
return new Promise(resolve => {
|
||||
let waitForIt = function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue