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

Side by Side Diff: runtime/observatory/test/metrics_test.dart

Issue 886353006: Port metrics to RPC (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 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 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 'package:observatory/service_io.dart'; 5 import 'package:observatory/service_io.dart';
6 import 'package:unittest/unittest.dart'; 6 import 'package:unittest/unittest.dart';
7 import 'test_helper.dart'; 7 import 'test_helper.dart';
8 8
9 import 'dart:profiler'; 9 import 'dart:profiler';
10 10
11 void script() { 11 void script() {
12 var counter = new Counter('a.b.c', 'description'); 12 var counter = new Counter('a.b.c', 'description');
13 Metrics.register(counter); 13 Metrics.register(counter);
14 counter.value = 1234.5; 14 counter.value = 1234.5;
15 } 15 }
16 16
17 var tests = [ 17 var tests = [
18 18
19 (Isolate isolate) => 19 (Isolate isolate) =>
20 isolate.getDeprecated('metrics').then((ServiceMap metrics) { 20 isolate.refreshDartMetrics().then((Map metrics) {
21 expect(metrics['type'], equals('MetricList')); 21 expect(metrics.length, equals(1));
22 var members = metrics['members']; 22 var counter = metrics['metrics/a.b.c'];
23 expect(members, isList);
24 expect(members.length, equals(1));
25 var counter = members[0];
26 expect(counter.name, equals('a.b.c')); 23 expect(counter.name, equals('a.b.c'));
27 expect(counter.value, equals(1234.5)); 24 expect(counter.value, equals(1234.5));
28 }), 25 }),
29 26
30 (Isolate isolate) => 27 (Isolate isolate) =>
31 isolate.getDeprecated('metrics/a.b.c').then((ServiceMetric counter) { 28 isolate.invokeRpc('getIsolateMetric', { 'metricId': 'metrics/a.b.c' })
29 .then((ServiceMetric counter) {
32 expect(counter.name, equals('a.b.c')); 30 expect(counter.name, equals('a.b.c'));
33 expect(counter.value, equals(1234.5)); 31 expect(counter.value, equals(1234.5));
34 }), 32 }),
35 33
36 (Isolate isolate) => 34 (Isolate isolate) =>
37 isolate.getDeprecated('metrics/a.b.d').then((DartError err) { 35 isolate.invokeRpc('getIsolateMetric', { 'metricId': 'metrics/a.b.d' })
36 .then((DartError err) {
38 expect(err is DartError, isTrue); 37 expect(err is DartError, isTrue);
39 }), 38 }),
40
41 ]; 39 ];
42 40
43 main(args) => runIsolateTests(args, tests, testeeBefore: script); 41 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW
« no previous file with comments | « runtime/observatory/test/malformed_test.dart ('k') | runtime/observatory/test/mirror_references_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698