Index: runtime/observatory/tests/service/logging_test.dart |
diff --git a/runtime/observatory/tests/service/logging_test.dart b/runtime/observatory/tests/service/logging_test.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..42f0140f2c634c6d2100403fedea2273ca457636 |
--- /dev/null |
+++ b/runtime/observatory/tests/service/logging_test.dart |
@@ -0,0 +1,46 @@ |
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+// VMOptions=--compile_all --error_on_bad_type --error_on_bad_override |
+ |
+import 'dart:developer' as developer; |
+import 'package:observatory/service_io.dart'; |
+import 'package:unittest/unittest.dart'; |
+import 'package:logging/logging.dart'; |
+ |
+import 'test_helper.dart'; |
+ |
+void init() { |
+ Logger.root.level = Level.ALL; |
+ Logger.root.onRecord.listen(developer.logOnRecord); |
+} |
+ |
+void run() { |
+ developer.debugger(); |
+ Logger.root.fine('Hey Buddy!'); |
+ developer.debugger(); |
+ Logger.root.info('YES'); |
+} |
+ |
+var tests = [ |
+ hasStoppedAtBreakpoint, |
+ resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) { |
+ expect(event.kind, equals(ServiceEvent.kLogging)); |
+ expect(event.logRecord['sequenceNumber'], equals(0)); |
+ expect(event.logRecord['message'].valueAsString, equals('Hey Buddy!')); |
+ expect(event.logRecord['level'], equals(Level.FINE)); |
+ expect(event.logRecord['time'], new isInstanceOf<DateTime>()); |
+ }), |
+ resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) { |
+ expect(event.kind, equals(ServiceEvent.kLogging)); |
+ expect(event.logRecord['sequenceNumber'], equals(1)); |
+ expect(event.logRecord['level'], equals(Level.INFO)); |
+ expect(event.logRecord['message'].valueAsString, equals('YES')); |
+ expect(event.logRecord['time'], new isInstanceOf<DateTime>()); |
+ }), |
+]; |
+ |
+main(args) => runIsolateTests(args, |
+ tests, |
+ testeeBefore: init, |
+ testeeConcurrent: run); |