From ee7c7dfd5996434e4e84a2a41a7142be15180464 Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum Date: Tue, 14 Nov 2017 14:25:22 -0800 Subject: [PATCH] Use pumpEventQueue() from test (#22) --- pubspec.yaml | 2 +- test/client/stream_test.dart | 2 -- test/client/utils.dart | 12 ------------ test/server/stream_test.dart | 2 -- test/server/utils.dart | 12 ------------ 5 files changed, 1 insertion(+), 29 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index 724e4d7..f80caa3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -7,6 +7,6 @@ dependencies: stack_trace: '>=0.9.1 <2.0.0' stream_channel: '^1.1.0' dev_dependencies: - test: "^0.12.21" + test: "^0.12.28" environment: sdk: ">=1.8.0 <2.0.0" diff --git a/test/client/stream_test.dart b/test/client/stream_test.dart index 031d38d..fb71f17 100644 --- a/test/client/stream_test.dart +++ b/test/client/stream_test.dart @@ -9,8 +9,6 @@ import 'package:test/test.dart'; import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc; -import 'utils.dart'; - void main() { var responseController; var requestController; diff --git a/test/client/utils.dart b/test/client/utils.dart index 9b4dd79..9b35da5 100644 --- a/test/client/utils.dart +++ b/test/client/utils.dart @@ -54,15 +54,3 @@ class ClientController { _responseController.add(request); } } - -/// Returns a [Future] that completes after pumping the event queue [times] -/// times. By default, this should pump the event queue enough times to allow -/// any code to run, as long as it's not waiting on some external event. -Future pumpEventQueue([int times = 20]) { - if (times == 0) return new Future.value(); - // We use a delayed future to allow microtask events to finish. The - // Future.value or Future() constructors use scheduleMicrotask themselves and - // would therefore not wait for microtask callbacks that are scheduled after - // invoking this method. - return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); -} diff --git a/test/server/stream_test.dart b/test/server/stream_test.dart index 7be0001..bc320ed 100644 --- a/test/server/stream_test.dart +++ b/test/server/stream_test.dart @@ -9,8 +9,6 @@ import 'package:test/test.dart'; import 'package:json_rpc_2/json_rpc_2.dart' as json_rpc; -import 'utils.dart'; - void main() { var requestController; var responseController; diff --git a/test/server/utils.dart b/test/server/utils.dart index 02d9f34..f2345fc 100644 --- a/test/server/utils.dart +++ b/test/server/utils.dart @@ -71,15 +71,3 @@ Matcher throwsInvalidParams(String message) { return true; })); } - -/// Returns a [Future] that completes after pumping the event queue [times] -/// times. By default, this should pump the event queue enough times to allow -/// any code to run, as long as it's not waiting on some external event. -Future pumpEventQueue([int times = 20]) { - if (times == 0) return new Future.value(); - // We use a delayed future to allow microtask events to finish. The - // Future.value or Future() constructors use scheduleMicrotask themselves and - // would therefore not wait for microtask callbacks that are scheduled after - // invoking this method. - return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1)); -}