| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 | |
| 5 import 'package:observatory/service_io.dart'; | |
| 6 import 'package:unittest/unittest.dart'; | |
| 7 import 'test_helper.dart'; | |
| 8 | |
| 9 import 'dart:profiler'; | |
| 10 | |
| 11 void script() { | |
| 12 var counter = new Counter('a.b.c', 'description'); | |
| 13 Metrics.register(counter); | |
| 14 counter.value = 1234.5; | |
| 15 } | |
| 16 | |
| 17 var tests = [ | |
| 18 | |
| 19 (Isolate isolate) => | |
| 20 isolate.get('metrics').then((ServiceMap metrics) { | |
| 21 expect(metrics['type'], equals('MetricList')); | |
| 22 var members = metrics['members']; | |
| 23 expect(members, isList); | |
| 24 expect(members.length, equals(1)); | |
| 25 var counter = members[0]; | |
| 26 expect(counter.name, equals('a.b.c')); | |
| 27 expect(counter.value, equals(1234.5)); | |
| 28 }), | |
| 29 | |
| 30 (Isolate isolate) => | |
| 31 isolate.get('metrics/a.b.c').then((ServiceMetric counter) { | |
| 32 expect(counter.name, equals('a.b.c')); | |
| 33 expect(counter.value, equals(1234.5)); | |
| 34 }), | |
| 35 | |
| 36 (Isolate isolate) => | |
| 37 isolate.get('metrics/a.b.d').then((DartError err) { | |
| 38 expect(err is DartError, isTrue); | |
| 39 }), | |
| 40 | |
| 41 ]; | |
| 42 | |
| 43 main(args) => runIsolateTests(args, tests, testeeBefore: script); | |
| OLD | NEW |