Increase the default test timeout for scheduled tests on Windows.

Review URL: https://codereview.chromium.org//13327009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20695 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
nweiz@google.com 2013-03-29 21:47:35 +00:00
parent bb22c8d376
commit f5534bdb3f
6 changed files with 39 additions and 4 deletions

View file

@ -17,6 +17,12 @@ import 'utils.dart';
String sandbox;
void main() {
metaSetUp(() {
// The windows bots are very slow, so we increase the default timeout.
if (Platform.operatingSystem != "windows") return;
currentSchedule.timeout = new Duration(seconds: 10);
});
expectTestsPass('file().create() creates a file', () {
test('test', () {
scheduleSandbox();

View file

@ -15,6 +15,7 @@ import 'dart:isolate';
import 'package:pathos/path.dart' as path;
import 'package:unittest/unittest.dart';
import 'package:scheduled_test/scheduled_test.dart' as scheduled_test;
import 'utils.dart';
@ -71,6 +72,14 @@ void expectTestsFail(String description, void body()) {
});
}
/// Runs [setUpFn] before every metatest. Note that [setUpFn] will be
/// overwritten if the test itself calls [setUp].
void metaSetUp(void setUpFn()) {
_inChildIsolate.then((inIsolate) {
if (inIsolate) scheduled_test.setUp(setUpFn);
});
}
/// Sets up a test with the given [description] and [body]. After the test runs,
/// calls [validate] with the result map.
void _setUpTest(String description, void body(), void validate(Map)) {

View file

@ -16,6 +16,12 @@ import 'metatest.dart';
import 'utils.dart';
void main() {
metaSetUp(() {
// The windows bots are very slow, so we increase the default timeout.
if (Platform.operatingSystem != "windows") return;
currentSchedule.timeout = new Duration(seconds: 10);
});
expectTestsPass("a process must have kill() or shouldExit() called", () {
var errors;
test('test 1', () {

View file

@ -16,6 +16,12 @@ import 'metatest.dart';
import 'utils.dart';
void main() {
metaSetUp(() {
// The windows bots are very slow, so we increase the default timeout.
if (Platform.operatingSystem != "windows") return;
currentSchedule.timeout = new Duration(seconds: 10);
});
expectTestsPass("a server with no handlers does nothing", () {
test('test', () => new ScheduledServer());
});

View file

@ -5,6 +5,7 @@
library scheduled_test_test;
import 'dart:async';
import 'dart:io';
import 'package:scheduled_test/scheduled_test.dart';
import 'package:scheduled_test/src/mock_clock.dart' as mock_clock;
@ -13,6 +14,12 @@ import 'metatest.dart';
import 'utils.dart';
void main() {
metaSetUp(() {
// The windows bots are very slow, so we increase the default timeout.
if (Platform.operatingSystem != "windows") return;
currentSchedule.timeout = new Duration(seconds: 10);
});
expectTestsPass('a scheduled test with a correct synchronous expectation '
'should pass', () {
test('test', () {

View file

@ -212,10 +212,6 @@ final String packagesPath = "$appPath/packages";
/// Set to true when the current batch of scheduled events should be aborted.
bool _abortScheduled = false;
/// The time (in milliseconds) to wait for the entire scheduled test to
/// complete.
final _TIMEOUT = 30000;
/// Defines an integration test. The [body] should schedule a series of
/// operations which will be run asynchronously.
void integration(String description, void body()) =>
@ -227,6 +223,11 @@ void solo_integration(String description, void body()) =>
void _integration(String description, void body(), [Function testFn]) {
testFn(description, () {
// The windows bots are very slow, so we increase the default timeout.
if (Platform.operatingSystem == "windows") {
currentSchedule.timeout = new Duration(seconds: 10);
}
// Ensure the SDK version is always available.
d.dir(sdkPath, [
d.file('version', '0.1.2.3')