Chromium Code Reviews| Index: sdk/lib/_internal/pub/test/serve/utils.dart |
| diff --git a/sdk/lib/_internal/pub/test/serve/utils.dart b/sdk/lib/_internal/pub/test/serve/utils.dart |
| index ef58d330a2701197292eee3ec0c627edd76585b6..0a083cf2289c304a1dc8b5b67f421578f2e654f5 100644 |
| --- a/sdk/lib/_internal/pub/test/serve/utils.dart |
| +++ b/sdk/lib/_internal/pub/test/serve/utils.dart |
| @@ -11,6 +11,7 @@ import 'dart:io'; |
| import 'package:http/http.dart' as http; |
| import 'package:path/path.dart' as p; |
| import 'package:scheduled_test/scheduled_process.dart'; |
| +import 'package:scheduled_test/scheduled_stream.dart'; |
| import 'package:scheduled_test/scheduled_test.dart'; |
| import '../test_pub.dart'; |
| @@ -133,24 +134,19 @@ ScheduledProcess pubServe({bool shouldGetFirst: false, |
| }); |
| if (shouldGetFirst) { |
| - expect(_pubServer.nextLine(), |
| - completion(anyOf( |
| - startsWith("Your pubspec has changed"), |
| - startsWith("You don't have a lockfile"), |
| - startsWith("You are missing some dependencies")))); |
| - expect(_pubServer.nextLine(), |
| - completion(startsWith("Resolving dependencies..."))); |
| - |
| + _pubServer.stdout.expect(anyOf( |
| + startsWith("Your pubspec has changed"), |
| + startsWith("You don't have a lockfile"), |
| + startsWith("You are missing some dependencies"))); |
| + _pubServer.stdout.expect(startsWith("Resolving dependencies...")); |
| for (var i = 0; i < numDownloads; i++) { |
| - expect(_pubServer.nextLine(), |
| - completion(startsWith("Downloading"))); |
| + _pubServer.stdout.expect(startsWith("Downloading")); |
|
Bob Nystrom
2014/02/14 17:55:02
I hacked in the numDownloads stuff because at the
nweiz
2014/02/18 22:01:10
Done.
|
| } |
| - expect(_pubServer.nextLine(), |
| - completion(equals("Got dependencies!"))); |
| + _pubServer.stdout.expect(equals("Got dependencies!")); |
| } |
| - expect(_pubServer.nextLine().then(_parsePort), completes); |
| + expect(schedule(() => _pubServer.stdout.next()).then(_parsePort), completes); |
| return _pubServer; |
| } |
| @@ -223,18 +219,8 @@ void postShould405(String urlPath) { |
| /// |
| /// The schedule will not proceed until the output is found. If not found, it |
| /// will eventually time out. |
| -void waitForBuildSuccess() { |
| - nextLine() { |
| - return _pubServer.nextLine().then((line) { |
| - if (line.contains("successfully")) return null; |
| - |
| - // This line wasn't it, so ignore it and keep trying. |
| - return nextLine(); |
| - }); |
| - } |
| - |
| - schedule(nextLine); |
| -} |
| +void waitForBuildSuccess() => |
| + _pubServer.stdout.expect(consumeThrough(contains("successfully"))); |
|
Bob Nystrom
2014/02/14 17:55:02
\o/
|
| /// Schedules opening a web socket connection to the currently running pub |
| /// serve. |