OLD | NEW |
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=--error_on_bad_type --error_on_bad_override | 4 // VMOptions=--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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // missing limit. | 56 // missing limit. |
57 (Isolate isolate) async { | 57 (Isolate isolate) async { |
58 var obj = await eval(isolate, 'globalObject'); | 58 var obj = await eval(isolate, 'globalObject'); |
59 var params = { | 59 var params = { |
60 'targetId': obj['id'], | 60 'targetId': obj['id'], |
61 }; | 61 }; |
62 bool caughtException; | 62 bool caughtException; |
63 try { | 63 try { |
64 await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); | 64 await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); |
65 expect(false, isTrue, reason:'Unreachable'); | 65 expect(false, isTrue, reason: 'Unreachable'); |
66 } on ServerRpcException catch (e) { | 66 } on ServerRpcException catch (e) { |
67 caughtException = true; | 67 caughtException = true; |
68 expect(e.code, equals(ServerRpcException.kInvalidParams)); | 68 expect(e.code, equals(ServerRpcException.kInvalidParams)); |
69 expect(e.data['details'], | 69 expect(e.data['details'], |
70 "_getRetainingPath expects the \'limit\' parameter"); | 70 "_getRetainingPath expects the \'limit\' parameter"); |
71 } | 71 } |
72 expect(caughtException, isTrue); | 72 expect(caughtException, isTrue); |
73 }, | 73 }, |
74 | 74 |
75 (Isolate isolate) async { | 75 (Isolate isolate) async { |
76 var target1 = await eval( | 76 var target1 = await eval( |
77 isolate, '() { var tmp = target1; target1 = null; return tmp;} ()'); | 77 isolate, '() { var tmp = target1; target1 = null; return tmp;} ()'); |
78 var params = { | 78 var params = { |
79 'targetId': target1['id'], | 79 'targetId': target1['id'], |
80 'limit': 100, | 80 'limit': 100, |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 (Isolate isolate) async { | 117 (Isolate isolate) async { |
118 var target4 = await eval( | 118 var target4 = await eval( |
119 isolate, '() { var tmp = target4; target4 = null; return tmp;} ()'); | 119 isolate, '() { var tmp = target4; target4 = null; return tmp;} ()'); |
120 var params = { | 120 var params = { |
121 'targetId': target4['id'], | 121 'targetId': target4['id'], |
122 'limit': 100, | 122 'limit': 100, |
123 }; | 123 }; |
124 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); | 124 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); |
125 expect(result['type'], equals('RetainingPath')); | 125 expect(result['type'], equals('RetainingPath')); |
126 expect(result['elements'].length, equals(3)); | 126 expect(result['elements'].length, equals(3)); |
127 expect(result['elements'][1]['parentMapKey']['valueAsString'], | 127 expect( |
128 equals('key')); | 128 result['elements'][1]['parentMapKey']['valueAsString'], equals('key')); |
129 expect(result['elements'][2]['value']['name'], equals('globalMap1')); | 129 expect(result['elements'][2]['value']['name'], equals('globalMap1')); |
130 }, | 130 }, |
131 | 131 |
132 (Isolate isolate) async { | 132 (Isolate isolate) async { |
133 var target5 = await eval( | 133 var target5 = await eval( |
134 isolate, '() { var tmp = target5; target5 = null; return tmp;} ()'); | 134 isolate, '() { var tmp = target5; target5 = null; return tmp;} ()'); |
135 var params = { | 135 var params = { |
136 'targetId': target5['id'], | 136 'targetId': target5['id'], |
137 'limit': 100, | 137 'limit': 100, |
138 }; | 138 }; |
139 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); | 139 var result = await isolate.invokeRpcNoUpgrade('_getRetainingPath', params); |
140 expect(result['type'], equals('RetainingPath')); | 140 expect(result['type'], equals('RetainingPath')); |
141 expect(result['elements'].length, equals(3)); | 141 expect(result['elements'].length, equals(3)); |
142 expect(result['elements'][1]['parentMapKey']['class']['name'], | 142 expect(result['elements'][1]['parentMapKey']['class']['name'], |
143 equals('_TestClass')); | 143 equals('_TestClass')); |
144 expect(result['elements'][2]['value']['name'], equals('globalMap2')); | 144 expect(result['elements'][2]['value']['name'], equals('globalMap2')); |
145 } | 145 } |
146 ]; | 146 ]; |
147 | 147 |
148 main(args) async => runIsolateTests(args, tests, testeeBefore:warmup); | 148 main(args) async => runIsolateTests(args, tests, testeeBefore: warmup); |
OLD | NEW |