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

Side by Side Diff: runtime/observatory/tests/service/get_retaining_path_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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override 4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override
5 5
6 import 'package:observatory/service_io.dart'; 6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 8
9 import 'test_helper.dart'; 9 import 'test_helper.dart';
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); 49 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params);
50 expect(result['elements'][1]['value']['name'], equals('globalObject')); 50 expect(result['elements'][1]['value']['name'], equals('globalObject'));
51 }, 51 },
52 52
53 // missing limit. 53 // missing limit.
54 (Isolate isolate) async { 54 (Isolate isolate) async {
55 var obj = await eval(isolate, 'globalObject'); 55 var obj = await eval(isolate, 'globalObject');
56 var params = { 56 var params = {
57 'targetId': obj['id'], 57 'targetId': obj['id'],
58 }; 58 };
59 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); 59 bool caughtException;
60 expect(result['message'], contains("invalid 'limit' parameter")); 60 try {
61 await isolate.invokeRpcNoUpgrade('_getRetainingPath', params);
62 expect(false, isTrue, reason:'Unreachable');
63 } on ServerRpcException catch (e) {
64 caughtException = true;
65 expect(e.code, equals(ServerRpcException.kInvalidParams));
66 expect(e.data['details'],
67 "_getRetainingPath expects the \'limit\' parameter");
68 }
69 expect(caughtException, isTrue);
61 }, 70 },
62 71
63 (Isolate isolate) async { 72 (Isolate isolate) async {
64 var target1 = await eval( 73 var target1 = await eval(
65 isolate, '() { var tmp = target1; target1 = null; return tmp;} ()'); 74 isolate, '() { var tmp = target1; target1 = null; return tmp;} ()');
66 var params = { 75 var params = {
67 'targetId': target1['id'], 76 'targetId': target1['id'],
68 'limit': 4, 77 'limit': 4,
69 }; 78 };
70 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); 79 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params);
(...skipping 23 matching lines...) Expand all
94 'limit': 4, 103 'limit': 4,
95 }; 104 };
96 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); 105 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params);
97 expect(result['type'], equals('RetainingPath')); 106 expect(result['type'], equals('RetainingPath'));
98 expect(result['elements'][0]['parentListIndex'], equals(12)); 107 expect(result['elements'][0]['parentListIndex'], equals(12));
99 expect(result['elements'][2]['value']['name'], equals('globalList')); 108 expect(result['elements'][2]['value']['name'], equals('globalList'));
100 }, 109 },
101 ]; 110 ];
102 111
103 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup); 112 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698