| OLD | NEW |
| 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 "dart:async"; | 5 import "dart:async"; |
| 6 import "package:unittest/unittest.dart"; | 6 import "package:unittest/unittest.dart"; |
| 7 | 7 |
| 8 // Test that stream listener callbacks all happen in the zone where the | 8 // Test that stream listener callbacks all happen in the zone where the |
| 9 // listen occurred. | 9 // listen occurred. |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 sub.onData(expectAsync((v) { | 40 sub.onData(expectAsync((v) { |
| 41 expect(v, 37); | 41 expect(v, 37); |
| 42 expect(Zone.current, newZone1); | 42 expect(Zone.current, newZone1); |
| 43 runZoned(() { | 43 runZoned(() { |
| 44 Zone newZone2 = Zone.current; | 44 Zone newZone2 = Zone.current; |
| 45 sub.onData(expectAsync((v) { | 45 sub.onData(expectAsync((v) { |
| 46 expect(v, 87); | 46 expect(v, 87); |
| 47 expect(Zone.current, newZone1); | 47 expect(Zone.current, newZone1); |
| 48 })); | 48 })); |
| 49 }); | 49 }); |
| 50 controller.add(87); | 50 if (controller is SynchronousStreamController) { |
| 51 scheduleMicrotask(() => controller.add(87)); |
| 52 } else { |
| 53 controller.add(87); |
| 54 } |
| 51 })); | 55 })); |
| 52 }); | 56 }); |
| 53 controller.add(37); | 57 if (controller is SynchronousStreamController) { |
| 58 scheduleMicrotask(() => controller.add(37)); |
| 59 } else { |
| 60 controller.add(37); |
| 61 } |
| 54 })); | 62 })); |
| 55 }); | 63 }); |
| 56 controller.add(42); | 64 controller.add(42); |
| 57 }); | 65 }); |
| 58 } | 66 } |
| OLD | NEW |