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

Unified Diff: lib/src/backend/live_test_controller.dart

Issue 2091173002: Add metadata to messages emitted by live tests. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 6 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 | « lib/src/backend/live_test.dart ('k') | lib/src/backend/message.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/backend/live_test_controller.dart
diff --git a/lib/src/backend/live_test_controller.dart b/lib/src/backend/live_test_controller.dart
index a1543157edb204d2ac0c510aa887db6cadb2a05f..5e80c73e96acee583ba17a3e1650f417b2de3df1 100644
--- a/lib/src/backend/live_test_controller.dart
+++ b/lib/src/backend/live_test_controller.dart
@@ -9,6 +9,7 @@ import 'package:stack_trace/stack_trace.dart';
import 'group.dart';
import 'live_test.dart';
+import 'message.dart';
import 'state.dart';
import 'suite.dart';
import 'test.dart';
@@ -32,7 +33,7 @@ class _LiveTest extends LiveTest {
Stream<AsyncError> get onError => _controller._onErrorController.stream;
- Stream<String> get onPrint => _controller._onPrintController.stream;
+ Stream<Message> get onMessage => _controller._onMessageController.stream;
Future get onComplete => _controller.completer.future;
@@ -94,11 +95,12 @@ class LiveTestController {
final _onErrorController = new StreamController<AsyncError>
.broadcast(sync: true);
- /// The controller for [LiveTest.onPrint].
+ /// The controller for [LiveTest.onMessage].
///
/// This is synchronous to ensure that events are well-ordered across multiple
/// streams.
- final _onPrintController = new StreamController<String>.broadcast(sync: true);
+ final _onMessageController =
+ new StreamController<Message>.broadcast(sync: true);
/// The completer for [LiveTest.onComplete];
final completer = new Completer();
@@ -162,14 +164,14 @@ class LiveTestController {
_onStateChangeController.add(newState);
}
- /// Emits a line printed by the test over [LiveTest.onPrint].
- void print(String line) {
- if (_onPrintController.hasListener) {
- _onPrintController.add(line);
+ /// Emits message over [LiveTest.onMessage].
+ void message(Message message) {
+ if (_onMessageController.hasListener) {
+ _onMessageController.add(message);
} else {
- // Make sure all prints get surfaced one way or another to aid in
+ // Make sure all messages get surfaced one way or another to aid in
// debugging.
- Zone.ROOT.print(line);
+ Zone.ROOT.print(message.text);
}
}
« no previous file with comments | « lib/src/backend/live_test.dart ('k') | lib/src/backend/message.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698