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

Unified Diff: runtime/observatory/tests/service/logging_test.dart

Issue 1241683005: Support piping log data over the service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/observatory/tests/service/test_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « runtime/observatory/lib/src/service/object.dart ('k') | runtime/observatory/tests/service/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698