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

Unified 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: Mark stack trace test as failing. 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 side-by-side diff with in-line comments
Download patch
Index: tests/lib/async/zone_empty_description2_test.dart
diff --git a/tests/lib/async/zone_empty_description2_test.dart b/tests/lib/async/zone_empty_description2_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..ff57d948cd46fc287943997323b57cc399189fae
--- /dev/null
+++ b/tests/lib/async/zone_empty_description2_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:expect/expect.dart';
+import 'package:async_helper/async_helper.dart';
+import 'dart:async';
+
+testEmptyZoneDescription() {
+ Expect.identical(Zone.ROOT, Zone.current);
+ Zone forked = Zone.current.fork();
+ Expect.isFalse(identical(Zone.ROOT, forked));
+
+ asyncStart();
+ bool timerDidRun = false;
+ forked.createTimer(const Duration(milliseconds: 20), () {
+ // The createTimer functions on the Zone don't bind the closures.
+ Expect.identical(Zone.ROOT, Zone.current);
+ timerDidRun = true;
+ asyncEnd();
+ });
+ Expect.identical(Zone.ROOT, Zone.current);
+
+ asyncStart();
+ int periodicTimerCount = 0;
+ forked.createPeriodicTimer(const Duration(milliseconds: 20), (Timer timer) {
+ periodicTimerCount++;
+ if (periodicTimerCount == 4) {
+ timer.cancel();
+ asyncEnd();
+ }
+ // The createPeriodicTimer functions on the Zone don't bind the closures.
+ Expect.identical(Zone.ROOT, Zone.current);
+ });
+ Expect.identical(Zone.ROOT, Zone.current);
+}
+
+main() {
+ testEmptyZoneDescription();
+}

Powered by Google App Engine
This is Rietveld 408576698