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

Side by Side Diff: tests/html/async_cancellingisolate.dart

Issue 975213002: Add tests for timers in background isolates in Dartium. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review fixes Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/html/async_oneshot.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | tests/html/async_oneshot.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698