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

Unified Diff: runtime/observatory/tests/service/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/metrics_test.dart
diff --git a/runtime/observatory/tests/service/metrics_test.dart b/runtime/observatory/tests/service/metrics_test.dart
index 8630c1966d897061fcfa3866bcf92090efae1c63..0d0535ea8287c3c96f24da712ce62723d639bbb1 100644
--- a/runtime/observatory/tests/service/metrics_test.dart
+++ b/runtime/observatory/tests/service/metrics_test.dart
@@ -17,26 +17,36 @@ void script() {
var tests = [
-(Isolate isolate) =>
- isolate.refreshDartMetrics().then((Map metrics) {
+ (Isolate isolate) async {
+ Map metrics = await isolate.refreshDartMetrics();
expect(metrics.length, equals(1));
var counter = metrics['metrics/a.b.c'];
expect(counter.name, equals('a.b.c'));
expect(counter.value, equals(1234.5));
-}),
+ },
-(Isolate isolate) =>
- isolate.invokeRpc('getIsolateMetric', { 'metricId': 'metrics/a.b.c' })
- .then((ServiceMetric counter) {
+ (Isolate isolate) async {
+ var params = { 'metricId': 'metrics/a.b.c' };
+ ServiceMetric counter =
+ await isolate.invokeRpc('getIsolateMetric', params);
expect(counter.name, equals('a.b.c'));
expect(counter.value, equals(1234.5));
- }),
-
-(Isolate isolate) =>
- isolate.invokeRpc('getIsolateMetric', { 'metricId': 'metrics/a.b.d' })
- .then((DartError err) {
- expect(err is DartError, isTrue);
- }),
+ },
+
+ (Isolate isolate) async {
+ bool caughtException;
+ try {
+ await isolate.invokeRpc('getIsolateMetric',
+ { 'metricId': 'metrics/a.b.d' });
+ 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/a.b.d");
+ }
+ expect(caughtException, isTrue);
+ },
];
main(args) => runIsolateTests(args, tests, testeeBefore: script);
« no previous file with comments | « runtime/observatory/tests/service/malformed_test.dart ('k') | runtime/observatory/tests/service/native_metrics_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698