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

Side by Side Diff: tests/lib/async/zone_empty_description2_test.dart

Issue 87283003: Make the root zone's schduleMicrotask and create[Periodic]Timer bind the callback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding missing typo fixes. Created 7 years 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'package:expect/expect.dart'; 5 import 'package:expect/expect.dart';
6 import 'package:async_helper/async_helper.dart'; 6 import 'package:async_helper/async_helper.dart';
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 testEmptyZoneSpecification() { 9 testEmptyZoneSpecification() {
10 Expect.identical(Zone.ROOT, Zone.current); 10 Expect.identical(Zone.ROOT, Zone.current);
11 Zone forked = Zone.current.fork(); 11 Zone forked = Zone.current.fork();
12 Expect.isFalse(identical(Zone.ROOT, forked)); 12 Expect.isFalse(identical(Zone.ROOT, forked));
13 13
14 asyncStart(); 14 asyncStart();
15 bool timerDidRun = false; 15 bool timerDidRun = false;
16 forked.createTimer(const Duration(milliseconds: 20), () { 16 forked.createTimer(const Duration(milliseconds: 20), () {
17 // The createTimer functions on the Zone binds the closures. 17 // The createTimer function on the Zone binds the closures.
18 Expect.identical(forked, Zone.current); 18 Expect.identical(forked, Zone.current);
19 timerDidRun = true; 19 timerDidRun = true;
20 asyncEnd(); 20 asyncEnd();
21 }); 21 });
22 Expect.identical(Zone.ROOT, Zone.current); 22 Expect.identical(Zone.ROOT, Zone.current);
23 23
24 asyncStart(); 24 asyncStart();
25 int periodicTimerCount = 0; 25 int periodicTimerCount = 0;
26 forked.createPeriodicTimer(const Duration(milliseconds: 20), (Timer timer) { 26 forked.createPeriodicTimer(const Duration(milliseconds: 20), (Timer timer) {
27 periodicTimerCount++; 27 periodicTimerCount++;
28 if (periodicTimerCount == 4) { 28 if (periodicTimerCount == 4) {
29 timer.cancel(); 29 timer.cancel();
30 asyncEnd(); 30 asyncEnd();
31 } 31 }
32 // The createPeriodicTimer functions on the Zone binds the closures. 32 // The createPeriodicTimer function on the Zone binds the closures.
33 Expect.identical(forked, Zone.current); 33 Expect.identical(forked, Zone.current);
34 }); 34 });
35 Expect.identical(Zone.ROOT, Zone.current); 35 Expect.identical(Zone.ROOT, Zone.current);
36 } 36 }
37 37
38 main() { 38 main() {
39 testEmptyZoneSpecification(); 39 testEmptyZoneSpecification();
40 } 40 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698