| OLD | NEW |
| (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 main() { |
| 10 Completer done = new Completer(); |
| 11 List events = []; |
| 12 |
| 13 // runGuarded calls run, captures the synchronous error (if any) and |
| 14 // gives that one to handleUncaughtError. |
| 15 |
| 16 Expect.identical(Zone.ROOT, Zone.current); |
| 17 Zone forked; |
| 18 Map zoneValues = new Map(); |
| 19 var foo = const Symbol("foo"); |
| 20 var bar = const Symbol("bar"); |
| 21 zoneValues[foo] = 499; |
| 22 zoneValues[bar] = []; |
| 23 forked = Zone.current.fork(zoneValues: zoneValues); |
| 24 |
| 25 Expect.identical(Zone.ROOT, Zone.current); |
| 26 Expect.isNull(Zone.current[foo]); |
| 27 Expect.isNull(Zone.current[bar]); |
| 28 |
| 29 forked.run(() { |
| 30 Expect.equals(499, Zone.current[foo]); |
| 31 Expect.listEquals([], Zone.current[bar]); |
| 32 Zone.current[bar].add(42); |
| 33 }); |
| 34 Expect.identical(Zone.ROOT, Zone.current); |
| 35 Expect.isNull(Zone.current[foo]); |
| 36 Expect.isNull(Zone.current[bar]); |
| 37 |
| 38 forked.run(() { |
| 39 Expect.equals(499, Zone.current[foo]); |
| 40 Expect.listEquals([42], Zone.current[bar]); |
| 41 }); |
| 42 |
| 43 zoneValues = new Map(); |
| 44 var gee = const Symbol("gee"); |
| 45 zoneValues[gee] = 99; |
| 46 zoneValues[foo] = -499; |
| 47 Zone forkedChild = forked.fork(zoneValues: zoneValues); |
| 48 |
| 49 forkedChild.run(() { |
| 50 Expect.equals(-499, Zone.current[foo]); |
| 51 Expect.listEquals([42], Zone.current[bar]); |
| 52 Expect.equals(99, Zone.current[gee]); |
| 53 }); |
| 54 } |
| OLD | NEW |