mirror of
https://github.com/servo/servo.git
synced 2025-08-10 16:05:43 +01:00
Update web-platform-tests to revision 14cfa4d648cc1c853b4153268df672d21425f8c1
This commit is contained in:
parent
1b73cf3352
commit
75736751d9
1213 changed files with 19434 additions and 12344 deletions
|
@ -8,27 +8,27 @@
|
|||
async_test(function() {
|
||||
// Check whether requestIdleCallback with a timeout works when the event loop
|
||||
// is busy.
|
||||
var busy_raf_loop_iterations_remaining = 10; // Should take 20 * 40 = 400ms
|
||||
var busy_loop_iterations_remaining = 10; // Should take 20 * 40 = 400ms
|
||||
var idle_callback_scheduled;
|
||||
var idle_callback = this.step_func_done(function(deadline) {
|
||||
assert_false(deadline.didTimeout, "IdleDeadline.didTimeout MUST be false if requestIdleCallback wasn't scheduled due to a timeout");
|
||||
assert_equals(busy_raf_loop_iterations_remaining, 0, "Busy rAF loop should be finished by the time we get scheduled");
|
||||
assert_equals(busy_loop_iterations_remaining, 0, "Busy event loop should be finished by the time we get scheduled");
|
||||
});
|
||||
|
||||
var busy_raf_loop_iterations_remaining = 10; // Should take 20 * 40 = 400ms
|
||||
requestAnimationFrame(this.step_func(function busyRAFLoop() {
|
||||
var busy_loop_iterations_remaining = 10; // Should take 20 * 40 = 400ms
|
||||
step_timeout(this.step_func(function busyLoop() {
|
||||
var start_time = performance.now();
|
||||
if (!idle_callback_scheduled) {
|
||||
idle_callback_scheduled = start_time;
|
||||
requestIdleCallback(idle_callback);
|
||||
}
|
||||
|
||||
// Use up the whole frame budget.
|
||||
// Use up more than a frames worth of budget.
|
||||
while (performance.now() - start_time < 40) {
|
||||
}
|
||||
if (busy_raf_loop_iterations_remaining > 0) {
|
||||
busy_raf_loop_iterations_remaining--;
|
||||
requestAnimationFrame(busyRAFLoop);
|
||||
if (busy_loop_iterations_remaining > 0) {
|
||||
busy_loop_iterations_remaining--;
|
||||
step_timeout(busyLoop);
|
||||
}
|
||||
}));
|
||||
}, 'requestIdleCallback not scheduled when event loop is busy.');
|
||||
|
@ -36,7 +36,7 @@ async_test(function() {
|
|||
async_test(function() {
|
||||
// Check whether requestIdleCallback with a timeout works when the event loop
|
||||
// is busy.
|
||||
var busy_raf_loop_iterations_remaining = 10; // Should take 20 * 40 = 400ms
|
||||
var busy_loop_iterations_remaining = 10; // Should take 20 * 40 = 400ms
|
||||
var timeout = 200;
|
||||
var idle_callback_scheduled;
|
||||
var idle_callback = this.step_func_done(function(deadline) {
|
||||
|
@ -44,22 +44,22 @@ async_test(function() {
|
|||
assert_true(time_delta >= timeout, "Should only have been run after timeout");
|
||||
assert_true(deadline.timeRemaining() == 0, "IdleDeadline.timeRemaining MUST be equal to zero if requestIdleCallback was scheduled due to a timeout");
|
||||
assert_true(deadline.didTimeout, "IdleDeadline.didTimeout MUST be true if requestIdleCallback was scheduled due to a timeout");
|
||||
assert_true(busy_raf_loop_iterations_remaining > 0, "Busy rAF loop should still be going");
|
||||
assert_true(busy_loop_iterations_remaining > 0, "Busy event loop should still be going");
|
||||
});
|
||||
|
||||
requestAnimationFrame(this.step_func(function busyRAFLoop() {
|
||||
step_timeout(this.step_func(function busyLoop() {
|
||||
var start_time = performance.now();
|
||||
if (!idle_callback_scheduled) {
|
||||
idle_callback_scheduled = start_time;
|
||||
requestIdleCallback(idle_callback, { timeout: timeout });
|
||||
}
|
||||
|
||||
// Use up the whole frame budget.
|
||||
// Use up more than a frames worth of budget.
|
||||
while (performance.now() - start_time < 40) {
|
||||
}
|
||||
if (busy_raf_loop_iterations_remaining > 0) {
|
||||
busy_raf_loop_iterations_remaining--;
|
||||
requestAnimationFrame(busyRAFLoop);
|
||||
if (busy_loop_iterations_remaining > 0) {
|
||||
busy_loop_iterations_remaining--;
|
||||
step_timeout(busyLoop);
|
||||
}
|
||||
}));
|
||||
}, 'requestIdleCallback scheduled with timeout when event loop is busy.');
|
|
@ -23,6 +23,11 @@ dictionary IdleRequestOptions {
|
|||
unsigned long timeout;
|
||||
};
|
||||
|
||||
[Exposed=Window] interface IdleDeadline {
|
||||
DOMHighResTimeStamp timeRemaining();
|
||||
readonly attribute boolean didTimeout;
|
||||
};
|
||||
|
||||
callback IdleRequestCallback = void (IdleDeadline deadline);
|
||||
</pre>
|
||||
<script>
|
||||
|
@ -30,5 +35,19 @@ callback IdleRequestCallback = void (IdleDeadline deadline);
|
|||
idl_array.add_untested_idls(document.getElementById("untested_idl").textContent);
|
||||
idl_array.add_idls(document.getElementById("idl").textContent);
|
||||
idl_array.add_objects({Window: ["window"]});
|
||||
idl_array.test();
|
||||
|
||||
async_test(function() {
|
||||
var rIC = this.step_func(function(deadline) {
|
||||
idl_array.add_objects({IdleDeadline: [deadline]});
|
||||
idl_array.test();
|
||||
this.done();
|
||||
});
|
||||
if (window.requestIdleCallback) {
|
||||
requestIdleCallback(rIC);
|
||||
} else {
|
||||
idl_array.test();
|
||||
assert_unreached("IdleDeadline not supported");
|
||||
this.done();
|
||||
}
|
||||
}, "IdleDeadline object setup");
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue