зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1338255 - Remove remaining legacy generator from js/xpconnect/tests/. r=bholley
This commit is contained in:
Родитель
470c96cd31
Коммит
014382051d
|
@ -95,18 +95,14 @@ function checkWatchdog(expectInterrupt, continuation) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var gGenerator;
|
|
||||||
function continueTest() {
|
|
||||||
gGenerator.next();
|
|
||||||
}
|
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
|
|
||||||
// Run async.
|
// Run async.
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
|
|
||||||
// Instantiate the generator and kick it off.
|
// Run the async function.
|
||||||
gGenerator = testBody();
|
testBody().then(() => {
|
||||||
gGenerator.next();
|
do_test_finished();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
function testBody() {
|
async function testBody() {
|
||||||
// Check that we properly implement whatever behavior is specified by the
|
// Check that we properly implement whatever behavior is specified by the
|
||||||
// default profile for this configuration.
|
// default profile for this configuration.
|
||||||
checkWatchdog(isWatchdogEnabled(), continueTest);
|
await checkWatchdog(isWatchdogEnabled());
|
||||||
yield;
|
|
||||||
do_test_finished();
|
|
||||||
yield;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
function testBody() {
|
async function testBody() {
|
||||||
setWatchdogEnabled(false);
|
setWatchdogEnabled(false);
|
||||||
checkWatchdog(false, continueTest);
|
await checkWatchdog(false);
|
||||||
yield;
|
|
||||||
do_test_finished();
|
|
||||||
yield;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
function testBody() {
|
async function testBody() {
|
||||||
setWatchdogEnabled(true);
|
setWatchdogEnabled(true);
|
||||||
checkWatchdog(true, continueTest);
|
await checkWatchdog(true);
|
||||||
yield;
|
|
||||||
do_test_finished();
|
|
||||||
yield;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
function testBody() {
|
async function testBody() {
|
||||||
|
|
||||||
setWatchdogEnabled(true);
|
setWatchdogEnabled(true);
|
||||||
|
|
||||||
|
@ -23,10 +23,11 @@ function testBody() {
|
||||||
// scheduling, we should never have more than 3 seconds of inactivity without
|
// scheduling, we should never have more than 3 seconds of inactivity without
|
||||||
// hibernating. To add some padding for automation, we mandate that hibernation
|
// hibernating. To add some padding for automation, we mandate that hibernation
|
||||||
// must begin between 2 and 5 seconds from now.
|
// must begin between 2 and 5 seconds from now.
|
||||||
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
await new Promise(resolve => {
|
||||||
timer.initWithCallback(continueTest, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
|
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
|
||||||
simulateActivityCallback(false);
|
timer.initWithCallback(resolve, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
|
||||||
yield;
|
simulateActivityCallback(false);
|
||||||
|
});
|
||||||
|
|
||||||
simulateActivityCallback(true);
|
simulateActivityCallback(true);
|
||||||
busyWait(1000); // Give the watchdog time to wake up on the condvar.
|
busyWait(1000); // Give the watchdog time to wake up on the condvar.
|
||||||
|
@ -47,7 +48,4 @@ function testBody() {
|
||||||
do_check_true(startHibernation > now + 2*1000*1000 - FUZZ_FACTOR);
|
do_check_true(startHibernation > now + 2*1000*1000 - FUZZ_FACTOR);
|
||||||
do_check_true(startHibernation < now + 5*1000*1000 + FUZZ_FACTOR);
|
do_check_true(startHibernation < now + 5*1000*1000 + FUZZ_FACTOR);
|
||||||
do_check_true(stopHibernation > now + 10*1000*1000 - FUZZ_FACTOR);
|
do_check_true(stopHibernation > now + 10*1000*1000 - FUZZ_FACTOR);
|
||||||
|
|
||||||
do_test_finished();
|
|
||||||
yield;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,9 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
function testBody() {
|
async function testBody() {
|
||||||
var defaultBehavior = isWatchdogEnabled();
|
var defaultBehavior = isWatchdogEnabled();
|
||||||
setWatchdogEnabled(!defaultBehavior);
|
setWatchdogEnabled(!defaultBehavior);
|
||||||
setWatchdogEnabled(defaultBehavior);
|
setWatchdogEnabled(defaultBehavior);
|
||||||
checkWatchdog(defaultBehavior, continueTest);
|
await checkWatchdog(defaultBehavior);
|
||||||
yield;
|
|
||||||
do_test_finished();
|
|
||||||
yield;
|
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче