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

Unified Diff: runtime/observatory/tests/service/get_allocation_profile_rpc_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/get_allocation_profile_rpc_test.dart
diff --git a/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart b/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart
index 4dab52c2aa4cfc1220def24cf5646de890fa5666..0217fa55c20dd52d24b7704b6759377c4986aef8 100644
--- a/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart
@@ -60,20 +60,35 @@ var tests = [
var params = {
'reset' : 'banana',
};
- var result = await isolate.invokeRpcNoUpgrade(
- '_getAllocationProfile', params);
- expect(result['type'], equals('Error'));
- expect(result['message'], contains("invalid 'reset' parameter"));
+ bool caughtException;
+ try {
+ await isolate.invokeRpcNoUpgrade('_getAllocationProfile', params);
+ expect(false, isTrue, reason:'Unreachable');
+ } on ServerRpcException catch (e) {
+ caughtException = true;
+ expect(e.code, equals(ServerRpcException.kInvalidParams));
+ expect(e.data['details'],
+ "_getAllocationProfile: invalid \'reset\' parameter: banana");
+ }
+ expect(caughtException, isTrue);
},
(Isolate isolate) async {
var params = {
'gc' : 'banana',
};
- var result = await isolate.invokeRpcNoUpgrade(
- '_getAllocationProfile', params);
- expect(result['type'], equals('Error'));
- expect(result['message'], contains("invalid 'gc' parameter"));
+ bool caughtException;
+ try {
+ await isolate.invokeRpcNoUpgrade(
+ '_getAllocationProfile', params);
+ expect(false, isTrue, reason:'Unreachable');
+ } on ServerRpcException catch (e) {
+ caughtException = true;
+ expect(e.code, equals(ServerRpcException.kInvalidParams));
+ expect(e.data['details'],
+ "_getAllocationProfile: invalid \'gc\' parameter: banana");
+ }
+ expect(caughtException, isTrue);
},
];

Powered by Google App Engine
This is Rietveld 408576698