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

Unified Diff: runtime/observatory/tests/service/native_metrics_test.dart

Issue 1120133002: Rework error handling in the service protocol and in Observatory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix tests Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/tests/service/native_metrics_test.dart
diff --git a/runtime/observatory/tests/service/native_metrics_test.dart b/runtime/observatory/tests/service/native_metrics_test.dart
index 8a8e11aaad888bb0c3fabae28764fd5843617aed..0a84204d43b732817458fc377569ecb58c436639 100644
--- a/runtime/observatory/tests/service/native_metrics_test.dart
+++ b/runtime/observatory/tests/service/native_metrics_test.dart
@@ -17,29 +17,38 @@ void script() {
var tests = [
-(Isolate isolate) =>
- isolate.refreshNativeMetrics().then((Map metrics) {
- expect(metrics.length, greaterThan(1));
- expect(metrics.length, greaterThan(1));
- var foundOldHeapCapacity = metrics.values.any((m) =>
- m.name == 'heap.old.capacity');
- expect(foundOldHeapCapacity, equals(true));
- }),
-
-(Isolate isolate) =>
- isolate.invokeRpc('getIsolateMetric',
- { 'metricId': 'metrics/native/heap.old.used' })
- .then((ServiceMetric counter) {
+ (Isolate isolate) async {
+ Map metrics = await isolate.refreshNativeMetrics();
+ expect(metrics.length, greaterThan(1));
+ expect(metrics.length, greaterThan(1));
+ var foundOldHeapCapacity = metrics.values.any(
+ (m) => m.name == 'heap.old.capacity');
+ expect(foundOldHeapCapacity, equals(true));
+ },
+
+ (Isolate isolate) async {
+ var params = { 'metricId': 'metrics/native/heap.old.used' };
+ ServiceMetric counter =
+ await isolate.invokeRpc('getIsolateMetric', params);
expect(counter.type, equals('Counter'));
expect(counter.name, equals('heap.old.used'));
- }),
-
-(Isolate isolate) =>
- isolate.invokeRpc('getIsolateMetric',
- { 'metricId': 'metrics/native/doesnotexist' })
- .then((DartError err) {
- expect(err is DartError, isTrue);
- }),
+ },
+
+ (Isolate isolate) async {
+ bool caughtException;
+ try {
+ await isolate.invokeRpc('getIsolateMetric',
+ { 'metricId': 'metrics/native/doesnotexist' });
+ expect(false, isTrue, reason:'Unreachable');
+ } on ServerRpcException catch (e) {
+ caughtException = true;
+ expect(e.code, equals(ServerRpcException.kInvalidParams));
+ expect(e.message,
+ "getIsolateMetric: invalid 'metricId' "
+ "parameter: metrics/native/doesnotexist");
+ }
+ expect(caughtException, isTrue);
+ },
];
« no previous file with comments | « runtime/observatory/tests/service/metrics_test.dart ('k') | runtime/observatory/tests/service/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698