| 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'; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 } | 49 } |
| 50 | 50 |
| 51 void test_logException_noTrace() { | 51 void test_logException_noTrace() { |
| 52 TestInstrumentationServer server = new TestInstrumentationServer(); | 52 TestInstrumentationServer server = new TestInstrumentationServer(); |
| 53 InstrumentationService service = new InstrumentationService(server); | 53 InstrumentationService service = new InstrumentationService(server); |
| 54 String message = 'exceptionMessage'; | 54 String message = 'exceptionMessage'; |
| 55 service.logException(message, null); | 55 service.logException(message, null); |
| 56 assertNormal(server, InstrumentationService.TAG_EXCEPTION, '$message:null'); | 56 assertNormal(server, InstrumentationService.TAG_EXCEPTION, '$message:null'); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void test_logFileRead() { |
| 60 TestInstrumentationServer server = new TestInstrumentationServer(); |
| 61 InstrumentationService service = new InstrumentationService(server); |
| 62 String path = '/file/path'; |
| 63 int time = 978336000000; |
| 64 String content = 'class C {\n}\n'; |
| 65 service.logFileRead(path, time, content); |
| 66 assertNormal( |
| 67 server, |
| 68 InstrumentationService.TAG_FILE_READ, |
| 69 '$path:$time:$content'); |
| 70 } |
| 71 |
| 59 void test_logLogEntry() { | 72 void test_logLogEntry() { |
| 60 TestInstrumentationServer server = new TestInstrumentationServer(); | 73 TestInstrumentationServer server = new TestInstrumentationServer(); |
| 61 InstrumentationService service = new InstrumentationService(server); | 74 InstrumentationService service = new InstrumentationService(server); |
| 62 String level = 'level'; | 75 String level = 'level'; |
| 63 DateTime time = new DateTime(2001); | 76 DateTime time = new DateTime(2001); |
| 64 String message = 'message'; | 77 String message = 'message'; |
| 65 service.logLogEntry(level, time, message); | 78 service.logLogEntry(level, time, message); |
| 66 assertNormal( | 79 assertNormal( |
| 67 server, | 80 server, |
| 68 InstrumentationService.TAG_LOG_ENTRY, | 81 InstrumentationService.TAG_LOG_ENTRY, |
| 69 '$level:2001-01-01 00::00::00.000:$message'); | 82 '$level:${time.millisecondsSinceEpoch}:$message'); |
| 70 } | 83 } |
| 71 | 84 |
| 72 void test_logNotification() { | 85 void test_logNotification() { |
| 73 TestInstrumentationServer server = new TestInstrumentationServer(); | 86 TestInstrumentationServer server = new TestInstrumentationServer(); |
| 74 InstrumentationService service = new InstrumentationService(server); | 87 InstrumentationService service = new InstrumentationService(server); |
| 75 String message = 'notificationText'; | 88 String message = 'notificationText'; |
| 76 service.logNotification(message); | 89 service.logNotification(message); |
| 77 assertNormal(server, InstrumentationService.TAG_NOTIFICATION, message); | 90 assertNormal(server, InstrumentationService.TAG_NOTIFICATION, message); |
| 78 } | 91 } |
| 79 | 92 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 @override | 160 @override |
| 148 void logWithPriority(String message) { | 161 void logWithPriority(String message) { |
| 149 priorityChannel.writeln(message); | 162 priorityChannel.writeln(message); |
| 150 } | 163 } |
| 151 | 164 |
| 152 @override | 165 @override |
| 153 void shutdown() { | 166 void shutdown() { |
| 154 // Ignored | 167 // Ignored |
| 155 } | 168 } |
| 156 } | 169 } |
| OLD | NEW |