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

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

Issue 2802973005: Migrate async tests to strong (Closed)
Patch Set: Created 3 years, 8 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 // 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 testEmptyZoneSpecification() {
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 // The createTimer function on the Zone binds the closures.
18 Expect.identical(forked, Zone.current);
19 timerDidRun = true;
20 asyncEnd();
21 });
22 Expect.identical(Zone.ROOT, Zone.current);
23
24 asyncStart();
25 int periodicTimerCount = 0;
26 forked.createPeriodicTimer(const Duration(milliseconds: 20), (Timer timer) {
27 periodicTimerCount++;
28 if (periodicTimerCount == 4) {
29 timer.cancel();
30 asyncEnd();
31 }
32 // The createPeriodicTimer function on the Zone binds the closures.
33 Expect.identical(forked, Zone.current);
34 });
35 Expect.identical(Zone.ROOT, Zone.current);
36 }
37
38 main() {
39 testEmptyZoneSpecification();
40 }
OLDNEW
« no previous file with comments | « tests/lib_strong/async/zone_debug_test.dart ('k') | tests/lib_strong/async/zone_empty_description_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698