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

Unified Diff: pkg/analyzer/test/instrumentation/instrumentation_test.dart

Issue 833633004: File-based and multicast InstrumentationServer implementations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 | « pkg/analyzer/lib/instrumentation/instrumentation.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/instrumentation/instrumentation_test.dart
diff --git a/pkg/analyzer/test/instrumentation/instrumentation_test.dart b/pkg/analyzer/test/instrumentation/instrumentation_test.dart
index a0345a7267508b803f63b2ad6f4b66efcb2b6b67..fee99bcbe581a69ae640d7dac8962c96866fb742 100644
--- a/pkg/analyzer/test/instrumentation/instrumentation_test.dart
+++ b/pkg/analyzer/test/instrumentation/instrumentation_test.dart
@@ -12,6 +12,7 @@ import '../reflective_tests.dart';
main() {
group('instrumentation', () {
runReflectiveTests(InstrumentationServiceTest);
+ runReflectiveTests(MulticastInstrumentationServerTest);
});
}
@@ -80,6 +81,47 @@ class InstrumentationServiceTest extends ReflectiveTestCase {
}
}
+@ReflectiveTestCase()
+class MulticastInstrumentationServerTest extends ReflectiveTestCase {
+ TestInstrumentationServer serverA = new TestInstrumentationServer();
+ TestInstrumentationServer serverB = new TestInstrumentationServer();
+ MulticastInstrumentationServer server;
+
+ void setUp() {
+ server = new MulticastInstrumentationServer([serverA, serverB]);
+ }
+
+ void test_log() {
+ server.log('foo bar');
+ _assertNormal(serverA, 'foo bar');
+ _assertNormal(serverB, 'foo bar');
+ }
+
+ void test_logWithPriority() {
+ server.logWithPriority('foo bar');
+ _assertPriority(serverA, 'foo bar');
+ _assertPriority(serverB, 'foo bar');
+ }
+
+ void test_shutdown() {
+ server.shutdown();
+ }
+
+ void _assertNormal(TestInstrumentationServer server, String message) {
+ String sent = server.normalChannel.toString();
+ if (!sent.endsWith('$message\n')) {
+ fail('Expected "...$message", found "$sent"');
+ }
+ }
+
+ void _assertPriority(TestInstrumentationServer server, String message) {
+ String sent = server.priorityChannel.toString();
+ if (!sent.endsWith('$message\n')) {
+ fail('Expected "...$message", found "$sent"');
+ }
+ }
+}
+
class TestInstrumentationServer implements InstrumentationServer {
StringBuffer normalChannel = new StringBuffer();
StringBuffer priorityChannel = new StringBuffer();
« no previous file with comments | « pkg/analyzer/lib/instrumentation/instrumentation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698