OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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:expect/expect.dart"; | 6 import "package:expect/expect.dart"; |
7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 | 8 |
9 class Tracer { | 9 class Tracer { |
10 final String expected; | 10 final String expected; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 tracer.trace("Y"); | 104 tracer.trace("Y"); |
105 if (shouldCancel) { | 105 if (shouldCancel) { |
106 await subscription.cancel(); | 106 await subscription.cancel(); |
107 tracer.trace("C"); | 107 tracer.trace("C"); |
108 done.complete(null); | 108 done.complete(null); |
109 } | 109 } |
110 }, onError: (error) { | 110 }, onError: (error) { |
111 Expect.equals(expectedError, error); | 111 Expect.equals(expectedError, error); |
112 tracer.trace("X"); | 112 tracer.trace("X"); |
113 }, onDone: () { | 113 }, onDone: () { |
114 tracer.done(); | 114 tracer.done(); |
115 done.complete(null); | 115 done.complete(null); |
116 }); | 116 }); |
117 return done.future.then((_) => tracer.done()); | 117 return done.future.then((_) => tracer.done()); |
118 } | 118 } |
119 | 119 |
120 test() async { | 120 test() async { |
121 // TODO(sigurdm): These tests are too dependent on scheduling, and buffering | 121 // TODO(sigurdm): These tests are too dependent on scheduling, and buffering |
122 // behavior. | 122 // behavior. |
123 await runTest(foo1, "abcdYefC", null, true); | 123 await runTest(foo1, "abcdYefC", null, true); |
124 await runTest(foo2, "abcX", "Error", false); | 124 await runTest(foo2, "abcX", "Error", false); |
125 await runTest(foo3, "abcYX", "Error", false); | 125 await runTest(foo3, "abcYX", "Error", false); |
126 await runTest(foo4, "abcdYeYfX", "Error2", false); | 126 await runTest(foo4, "abcdYeYfX", "Error2", false); |
127 } | 127 } |
128 | 128 |
129 | |
130 void main() { | 129 void main() { |
131 asyncTest(test); | 130 asyncTest(test); |
132 } | 131 } |
OLD | NEW |