Bug 1318720 - Don't test if idle callbacks may execute in the same period. r=smaug

MozReview-Commit-ID: HKjU4R6BChT
This commit is contained in:
Andreas Farre 2017-03-09 17:45:27 +01:00
Родитель c2f45a1b19
Коммит d68fa1945b
1 изменённых файлов: 0 добавлений и 32 удалений

Просмотреть файл

@ -5,38 +5,6 @@
<script src="/resources/testharnessreport.js"></script>
<script>
async_test(function() {
// Check that two separate calls to requestIdleCallbacks can run in the same
// idle period.
var callback_1_deadline;
var callback_1_has_run = false;
var callback_1 = function(deadline) {
callback_1_has_run = true;
var remaining = deadline.timeRemaining();
if (remaining >= 5) {
// Should be enough time to run the next callback in the current idle
// period.
callback_1_deadline = performance.now() + remaining;
}
};
var callback_2 = this.step_func(function(deadline) {
assert_true(callback_1_has_run, "Should run callbacks in order of posting if they don't have a timeout.");
if (callback_1_deadline != undefined) {
assert_true(performance.now() < callback_1_deadline, "Should be able to run both callbacks in the same idle period.");
this.done();
} else {
// Might not have had enough idle time, so try again.
callback_1_has_run = false;
setTimeout(function() {
requestIdleCallback(callback_1);
requestIdleCallback(callback_2);
}, 0);
}
});
requestIdleCallback(callback_1);
requestIdleCallback(callback_2);
}, 'requestIdleCallback can run multiple different requestIdleCallback callbacks in the same idle period.');
async_test(function() {
// Check that if an idle callback calls requestIdleCallback, the new callback
// doesn't get the same deadline (i.e., runs in a new idle period).