OLD | NEW |
| (Empty) |
1 import 'package:observatory/service_io.dart'; | |
2 import 'package:unittest/unittest.dart'; | |
3 import 'test_helper.dart'; | |
4 | |
5 import 'dart:profiler'; | |
6 | |
7 void script() { | |
8 var counter = new Counter('a.b.c', 'description'); | |
9 Metrics.register(counter); | |
10 counter.value = 1234.5; | |
11 } | |
12 | |
13 var tests = [ | |
14 | |
15 (Isolate isolate) => | |
16 isolate.get('metrics/vm').then((ServiceMap metrics) { | |
17 expect(metrics['type'], equals('MetricList')); | |
18 var members = metrics['members']; | |
19 expect(members, isList); | |
20 expect(members.length, greaterThan(1)); | |
21 var foundOldHeapCapacity = members.any((m) => | |
22 m.name == 'heap.old.capacity'); | |
23 expect(foundOldHeapCapacity, equals(true)); | |
24 }), | |
25 | |
26 (Isolate isolate) => | |
27 isolate.get('metrics/vm/heap.old.used').then((ServiceMetric counter) { | |
28 expect(counter.type, equals('Counter')); | |
29 expect(counter.name, equals('heap.old.used')); | |
30 }), | |
31 | |
32 (Isolate isolate) => | |
33 isolate.get('metrics/vm/doesnotexist').then((DartError err) { | |
34 expect(err is DartError, isTrue); | |
35 }), | |
36 | |
37 ]; | |
38 | |
39 main(args) => runIsolateTests(args, tests, testeeBefore: script); | |
OLD | NEW |