Bug 1338255 - Remove remaining legacy generator from js/xpconnect/tests/. r=bholley

This commit is contained in:
Tooru Fujisawa 2017-02-11 01:53:24 +09:00
Родитель 470c96cd31
Коммит 014382051d
6 изменённых файлов: 18 добавлений и 36 удалений

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

@ -95,18 +95,14 @@ function checkWatchdog(expectInterrupt, continuation) {
});
}
var gGenerator;
function continueTest() {
gGenerator.next();
}
function run_test() {
// Run async.
do_test_pending();
// Instantiate the generator and kick it off.
gGenerator = testBody();
gGenerator.next();
// Run the async function.
testBody().then(() => {
do_test_finished();
});
}

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

@ -2,11 +2,8 @@
* 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/. */
function testBody() {
async function testBody() {
// Check that we properly implement whatever behavior is specified by the
// default profile for this configuration.
checkWatchdog(isWatchdogEnabled(), continueTest);
yield;
do_test_finished();
yield;
await checkWatchdog(isWatchdogEnabled());
}

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

@ -2,10 +2,7 @@
* 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/. */
function testBody() {
async function testBody() {
setWatchdogEnabled(false);
checkWatchdog(false, continueTest);
yield;
do_test_finished();
yield;
await checkWatchdog(false);
}

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

@ -2,10 +2,7 @@
* 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/. */
function testBody() {
async function testBody() {
setWatchdogEnabled(true);
checkWatchdog(true, continueTest);
yield;
do_test_finished();
yield;
await checkWatchdog(true);
}

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

@ -2,7 +2,7 @@
* 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/. */
function testBody() {
async function testBody() {
setWatchdogEnabled(true);
@ -23,10 +23,11 @@ function testBody() {
// scheduling, we should never have more than 3 seconds of inactivity without
// hibernating. To add some padding for automation, we mandate that hibernation
// must begin between 2 and 5 seconds from now.
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.initWithCallback(continueTest, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
simulateActivityCallback(false);
yield;
await new Promise(resolve => {
var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.initWithCallback(resolve, 10000, Ci.nsITimer.TYPE_ONE_SHOT);
simulateActivityCallback(false);
});
simulateActivityCallback(true);
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 + 5*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
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function testBody() {
async function testBody() {
var defaultBehavior = isWatchdogEnabled();
setWatchdogEnabled(!defaultBehavior);
setWatchdogEnabled(defaultBehavior);
checkWatchdog(defaultBehavior, continueTest);
yield;
do_test_finished();
yield;
await checkWatchdog(defaultBehavior);
}