| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 tracer.trace("Y"); | 103 tracer.trace("Y"); |
| 104 if (shouldCancel) { | 104 if (shouldCancel) { |
| 105 await subscription.cancel(); | 105 await subscription.cancel(); |
| 106 tracer.trace("C"); | 106 tracer.trace("C"); |
| 107 done.complete(null); | 107 done.complete(null); |
| 108 } | 108 } |
| 109 }, onError: (error) { | 109 }, onError: (error) { |
| 110 Expect.equals(expectedError, error); | 110 Expect.equals(expectedError, error); |
| 111 tracer.trace("X"); | 111 tracer.trace("X"); |
| 112 }, onDone: () { | 112 }, onDone: () { |
| 113 tracer.done(); | 113 tracer.done(); |
| 114 done.complete(null); | 114 done.complete(null); |
| 115 }); | 115 }); |
| 116 return done.future.then((_) => tracer.done()); | 116 return done.future.then((_) => tracer.done()); |
| 117 } | 117 } |
| 118 | 118 |
| 119 test() async { | 119 test() async { |
| 120 // TODO(sigurdm): These tests are too dependent on scheduling, and buffering | 120 // TODO(sigurdm): These tests are too dependent on scheduling, and buffering |
| 121 // behavior. | 121 // behavior. |
| 122 await runTest(foo1, "abcdYefC", null, true); | 122 await runTest(foo1, "abcdYefC", null, true); |
| 123 await runTest(foo2, "abcX", "Error", false); | 123 await runTest(foo2, "abcX", "Error", false); |
| 124 await runTest(foo3, "abcYX", "Error", false); | 124 await runTest(foo3, "abcYX", "Error", false); |
| 125 await runTest(foo4, "abcdYeYfX", "Error2", false); | 125 await runTest(foo4, "abcdYeYfX", "Error2", false); |
| 126 } | 126 } |
| 127 | 127 |
| 128 | |
| 129 void main() { | 128 void main() { |
| 130 asyncTest(test); | 129 asyncTest(test); |
| 131 } | 130 } |
| OLD | NEW |