Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(549)

Side by Side Diff: test/codegen/lib/html/async_cancellingisolate.dart

Issue 1930043002: Add all dart:html tests from the sdk to test/codegen. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 library async_cancellingisolate;
2
3 import 'dart:async';
4 import 'package:unittest/unittest.dart';
5
6 main(message, replyTo) {
7 var command = message.first;
8 expect(command, 'START');
9 var shot = false;
10 var oneshot;
11 var periodic;
12 periodic = new Timer.periodic(const Duration(milliseconds: 10), (timer) {
13 expect(shot, isFalse);
14 shot = true;
15 expect(timer, same(periodic));
16 periodic.cancel();
17 oneshot.cancel();
18 // Wait some more time to be sure callbacks won't be invoked any
19 // more.
20 new Timer(const Duration(milliseconds: 50), () {
21 replyTo.send('DONE');
22 });
23 });
24 // We launch the oneshot timer after the periodic timer. Otherwise a
25 // (very long) context switch could make this test flaky: assume the
26 // oneshot timer is created first and then there is a 30ms context switch.
27 // when the periodic timer is scheduled it would execute after the oneshot.
28 oneshot = new Timer(const Duration(milliseconds: 30), () {
29 fail('Should never be invoked');
30 });
31 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698