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

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

Issue 23875032: Expose Zones. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Users can't customize runGuarded. More tests. Created 7 years, 3 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
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import 'package:expect/expect.dart';
6 import 'package:async_helper/async_helper.dart';
7 import 'dart:async';
8
9 testEmptyZoneDescription() {
10 Expect.identical(Zone.ROOT, Zone.current);
11 Zone forked = Zone.current.fork();
12 Expect.isFalse(identical(Zone.ROOT, forked));
13
14 asyncStart();
15 bool timerDidRun = false;
16 forked.createTimer(const Duration(milliseconds: 20), () {
17 Expect.identical(forked, Zone.current);
18 timerDidRun = true;
19 asyncEnd();
20 });
21 Expect.identical(Zone.ROOT, Zone.current);
22
23 asyncStart();
24 int periodicTimerCount = 0;
25 forked.createPeriodicTimer(const Duration(milliseconds: 20), (Timer timer) {
26 periodicTimerCount++;
27 if (periodicTimerCount == 4) {
28 timer.cancel();
29 asyncEnd();
30 }
31 Expect.identical(forked, Zone.current);
32 });
33 Expect.identical(Zone.ROOT, Zone.current);
34 }
35
36 main() {
37 testEmptyZoneDescription();
38 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698