| Index: tests/lib/async/timer_isolate_test.dart
|
| diff --git a/tests/lib/async/timer_isolate_test.dart b/tests/lib/async/timer_isolate_test.dart
|
| index 31776c5f5edb009b82cdd31b7ffd5559ed05a0b0..8c6c5fbf7165654b36853f311e6a35f8a7f6dada 100644
|
| --- a/tests/lib/async/timer_isolate_test.dart
|
| +++ b/tests/lib/async/timer_isolate_test.dart
|
| @@ -10,6 +10,11 @@ import '../../../pkg/unittest/lib/unittest.dart';
|
|
|
| const Duration TIMEOUT = const Duration(milliseconds: 100);
|
|
|
| +// Some browsers (Firefox and IE so far) can trigger too early. Add a safety
|
| +// margin. We use identical(1, 1.0) as an easy way to know if the test is
|
| +// compiled by dart2js.
|
| +int get safetyMargin => identical(1, 1.0) ? 100 : 1;
|
| +
|
| createTimer(replyTo) {
|
| new Timer(TIMEOUT, () {
|
| replyTo.send("timer_fired");
|
| @@ -26,7 +31,7 @@ main() {
|
| port.first.then(expectAsync1((msg) {
|
| expect("timer_fired", msg);
|
| int endTime = (new DateTime.now()).millisecondsSinceEpoch;
|
| - expect(endTime - startTime, greaterThanOrEqualTo(TIMEOUT.inMilliseconds));
|
| + expect(endTime - startTime + safetyMargin, greaterThanOrEqualTo(TIMEOUT.inMilliseconds));
|
| }));
|
|
|
| startTime = (new DateTime.now()).millisecondsSinceEpoch;
|
|
|