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(logRecord.message, | 15 developer.log( |
| 16 logRecord.message, |
16 time: logRecord.time, | 17 time: logRecord.time, |
17 sequenceNumber: logRecord.sequenceNumber, | 18 sequenceNumber: logRecord.sequenceNumber, |
18 level: logRecord.level.value, | 19 level: logRecord.level.value, |
19 name: logRecord.loggerName, | 20 name: logRecord.loggerName, |
20 zone: null, | 21 zone: null, |
21 error: logRecord.error, | 22 error: logRecord.error, |
22 stackTrace: logRecord.stackTrace); | 23 stackTrace: logRecord.stackTrace); |
23 }); | 24 }); |
24 } | 25 } |
25 | 26 |
(...skipping 16 matching lines...) Expand all Loading... |
42 hasStoppedAtBreakpoint, | 43 hasStoppedAtBreakpoint, |
43 resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) { | 44 resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) { |
44 expect(event.kind, equals(ServiceEvent.kLogging)); | 45 expect(event.kind, equals(ServiceEvent.kLogging)); |
45 expect(event.logRecord['sequenceNumber'], equals(1)); | 46 expect(event.logRecord['sequenceNumber'], equals(1)); |
46 expect(event.logRecord['level'], equals(Level.INFO)); | 47 expect(event.logRecord['level'], equals(Level.INFO)); |
47 expect(event.logRecord['message'].valueAsString, equals('YES')); | 48 expect(event.logRecord['message'].valueAsString, equals('YES')); |
48 expect(event.logRecord['time'], new isInstanceOf<DateTime>()); | 49 expect(event.logRecord['time'], new isInstanceOf<DateTime>()); |
49 }), | 50 }), |
50 ]; | 51 ]; |
51 | 52 |
52 main(args) => | 53 main(args) => runIsolateTests(args, |
53 runIsolateTests(args, tests, testeeBefore: init, testeeConcurrent: run); | 54 tests, |
| 55 testeeBefore: init, |
| 56 testeeConcurrent: run); |
OLD | NEW |