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

Unified Diff: pkg/sequence_zip/test/stream_test.dart

Issue 25982004: Make sequence-zip test not be timing dependent. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/sequence_zip/test/stream_test.dart
diff --git a/pkg/sequence_zip/test/stream_test.dart b/pkg/sequence_zip/test/stream_test.dart
index c3e82b8172810d2386da05172c86487087fbe18d..66a5d6252aaec39da6e08d281828a75b6073d524 100644
--- a/pkg/sequence_zip/test/stream_test.dart
+++ b/pkg/sequence_zip/test/stream_test.dart
@@ -141,15 +141,19 @@ main() {
test("Error after first end", () {
StreamController controller = new StreamController();
controller..add(7)..add(8)..add(9);
- testZip([mks([1, 2, 3]),
- mks([4, 5, 6]),
+ int ctr = 2;
+ Function addErrorIf(x) {
+ return (y) {
+ // Adds error to controller after both of the first two streams have
+ // provided all three elements.
+ if (x == y && --ctr == 0) Timer.run(() { controller.addError("BAD"); });
+ return y;
+ };
+ }
+ testZip([mks([1, 2, 3].map(addErrorIf(3))),
+ mks([4, 5, 6].map(addErrorIf(6))),
controller.stream],
[[1, 4, 7], [2, 5, 8], [3, 6, 9]]);
- // This comes after the first three events in all cases, since they
- // use durations no greater than 10 ms.
- new Timer(const Duration(milliseconds: 100), () {
- controller.addError("BAD");
- });
});
test("Pause/Resume", () {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698