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 import 'dart:developer' as developer; | 5 import 'dart:developer' as developer; |
6 import 'package:observatory/service_io.dart'; | 6 import 'package:observatory/service_io.dart'; |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'package:logging/logging.dart'; | 8 import 'package:logging/logging.dart'; |
9 import 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
10 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
11 | 11 |
12 void init() { | 12 void init() { |
13 Logger.root.level = Level.ALL; | 13 Logger.root.level = Level.ALL; |
14 Logger.root.onRecord.listen((logRecord) { | 14 Logger.root.onRecord.listen((logRecord) { |
15 developer.log( | 15 developer.log(logRecord.message, |
16 logRecord.message, | |
17 time: logRecord.time, | 16 time: logRecord.time, |
18 sequenceNumber: logRecord.sequenceNumber, | 17 sequenceNumber: logRecord.sequenceNumber, |
19 level: logRecord.level.value, | 18 level: logRecord.level.value, |
20 name: logRecord.loggerName, | 19 name: logRecord.loggerName, |
21 zone: null, | 20 zone: null, |
22 error: logRecord.error, | 21 error: logRecord.error, |
23 stackTrace: logRecord.stackTrace); | 22 stackTrace: logRecord.stackTrace); |
24 }); | 23 }); |
25 } | 24 } |
26 | 25 |
(...skipping 16 matching lines...) Expand all Loading... |
43 hasStoppedAtBreakpoint, | 42 hasStoppedAtBreakpoint, |
44 resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) { | 43 resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) { |
45 expect(event.kind, equals(ServiceEvent.kLogging)); | 44 expect(event.kind, equals(ServiceEvent.kLogging)); |
46 expect(event.logRecord['sequenceNumber'], equals(1)); | 45 expect(event.logRecord['sequenceNumber'], equals(1)); |
47 expect(event.logRecord['level'], equals(Level.INFO)); | 46 expect(event.logRecord['level'], equals(Level.INFO)); |
48 expect(event.logRecord['message'].valueAsString, equals('YES')); | 47 expect(event.logRecord['message'].valueAsString, equals('YES')); |
49 expect(event.logRecord['time'], new isInstanceOf<DateTime>()); | 48 expect(event.logRecord['time'], new isInstanceOf<DateTime>()); |
50 }), | 49 }), |
51 ]; | 50 ]; |
52 | 51 |
53 main(args) => runIsolateTests(args, | 52 main(args) => |
54 tests, | 53 runIsolateTests(args, tests, testeeBefore: init, testeeConcurrent: run); |
55 testeeBefore: init, | |
56 testeeConcurrent: run); | |
OLD | NEW |