| Index: tests/html/async_test.dart
|
| diff --git a/tests/html/async_test.dart b/tests/html/async_test.dart
|
| index 1d7768f878c1d2c23a3d751856ecc4ccbefc6265..616258cd17dbd607711a83d11d2be774843a361c 100644
|
| --- a/tests/html/async_test.dart
|
| +++ b/tests/html/async_test.dart
|
| @@ -40,10 +40,8 @@ periodicTimerIsolate() {
|
| cancellingIsolate() {
|
| port.receive((msg, replyTo) {
|
| expect(msg, 'START');
|
| - final oneshot = new Timer(const Duration(milliseconds: 30), () {
|
| - fail('Should never be invoked');
|
| - });
|
| bool shot = false;
|
| + var oneshot;
|
| var periodic;
|
| periodic = new Timer.periodic(const Duration(milliseconds: 10), (timer) {
|
| expect(shot, isFalse);
|
| @@ -57,6 +55,13 @@ cancellingIsolate() {
|
| replyTo.send('DONE');
|
| });
|
| });
|
| + // We launch the oneshot timer after the periodic timer. Otherwise a
|
| + // (very long) context switch could make this test flaky: assume the
|
| + // oneshot timer is created first and then there is a 30ms context switch.
|
| + // when the periodic timer is scheduled it would execute after the oneshot.
|
| + oneshot = new Timer(const Duration(milliseconds: 30), () {
|
| + fail('Should never be invoked');
|
| + });
|
| });
|
| }
|
|
|
|
|