Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library test.instrumentation; | 5 library test.instrumentation; |
| 6 | 6 |
| 7 import 'package:analyzer/instrumentation/instrumentation.dart'; | 7 import 'package:analyzer/instrumentation/instrumentation.dart'; |
| 8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
| 9 | 9 |
| 10 import '../reflective_tests.dart'; | 10 import '../reflective_tests.dart'; |
| 11 | 11 |
| 12 main() { | 12 main() { |
| 13 group('instrumentation', () { | 13 group('instrumentation', () { |
| 14 runReflectiveTests(InstrumentationServiceTest); | 14 runReflectiveTests(InstrumentationServiceTest); |
| 15 runReflectiveTests(MulticastInstrumentationServerTest); | 15 runReflectiveTests(MulticastInstrumentationServerTest); |
| 16 }); | 16 }); |
| 17 } | 17 } |
| 18 | 18 |
| 19 @ReflectiveTestCase() | 19 @reflectiveTest |
| 20 class InstrumentationServiceTest extends ReflectiveTestCase { | 20 class InstrumentationServiceTest extends ReflectiveTest { |
|
Brian Wilkerson
2015/01/13 17:06:22
This looks wrong. Why would we ever subclass the a
scheglov
2015/01/13 17:10:33
Good question.
It shouldn't.
Removed.
| |
| 21 void assertNormal(TestInstrumentationServer server, String tag, | 21 void assertNormal(TestInstrumentationServer server, String tag, |
| 22 String message) { | 22 String message) { |
| 23 String sent = server.normalChannel.toString(); | 23 String sent = server.normalChannel.toString(); |
| 24 if (!sent.endsWith(':$tag:$message\n')) { | 24 if (!sent.endsWith(':$tag:$message\n')) { |
| 25 fail('Expected "...:$tag:$message", found "$sent"'); | 25 fail('Expected "...:$tag:$message", found "$sent"'); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 void test_logError_withColon() { | 29 void test_logError_withColon() { |
| 30 TestInstrumentationServer server = new TestInstrumentationServer(); | 30 TestInstrumentationServer server = new TestInstrumentationServer(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 100 |
| 101 void test_logResponse() { | 101 void test_logResponse() { |
| 102 TestInstrumentationServer server = new TestInstrumentationServer(); | 102 TestInstrumentationServer server = new TestInstrumentationServer(); |
| 103 InstrumentationService service = new InstrumentationService(server); | 103 InstrumentationService service = new InstrumentationService(server); |
| 104 String message = 'responseText'; | 104 String message = 'responseText'; |
| 105 service.logResponse(message); | 105 service.logResponse(message); |
| 106 assertNormal(server, InstrumentationService.TAG_RESPONSE, message); | 106 assertNormal(server, InstrumentationService.TAG_RESPONSE, message); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 @ReflectiveTestCase() | 110 @reflectiveTest |
| 111 class MulticastInstrumentationServerTest extends ReflectiveTestCase { | 111 class MulticastInstrumentationServerTest extends ReflectiveTest { |
| 112 TestInstrumentationServer serverA = new TestInstrumentationServer(); | 112 TestInstrumentationServer serverA = new TestInstrumentationServer(); |
| 113 TestInstrumentationServer serverB = new TestInstrumentationServer(); | 113 TestInstrumentationServer serverB = new TestInstrumentationServer(); |
| 114 MulticastInstrumentationServer server; | 114 MulticastInstrumentationServer server; |
| 115 | 115 |
| 116 void setUp() { | 116 void setUp() { |
| 117 server = new MulticastInstrumentationServer([serverA, serverB]); | 117 server = new MulticastInstrumentationServer([serverA, serverB]); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void test_log() { | 120 void test_log() { |
| 121 server.log('foo bar'); | 121 server.log('foo bar'); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 @override | 160 @override |
| 161 void logWithPriority(String message) { | 161 void logWithPriority(String message) { |
| 162 priorityChannel.writeln(message); | 162 priorityChannel.writeln(message); |
| 163 } | 163 } |
| 164 | 164 |
| 165 @override | 165 @override |
| 166 void shutdown() { | 166 void shutdown() { |
| 167 // Ignored | 167 // Ignored |
| 168 } | 168 } |
| 169 } | 169 } |
| OLD | NEW |