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 11 matching lines...) Expand all Loading... |
22 Map params = { | 22 Map params = { |
23 'targetId': isolate.rootLibrary.id, | 23 'targetId': isolate.rootLibrary.id, |
24 'expression': expression, | 24 'expression': expression, |
25 }; | 25 }; |
26 return await isolate.invokeRpcNoUpgrade('evaluate', params); | 26 return await isolate.invokeRpcNoUpgrade('evaluate', params); |
27 } | 27 } |
28 | 28 |
29 var tests = [ | 29 var tests = [ |
30 (Isolate isolate) async { | 30 (Isolate isolate) async { |
31 // One instance of _TestClass retained. | 31 // One instance of _TestClass retained. |
32 var evalResult = await eval(isolate, 'myVar = new _TestClass(null, null)'); | 32 var evalResult = await eval( |
| 33 isolate, 'myVar = new _TestClass(null, null)'); |
33 var params = { | 34 var params = { |
34 'targetId': evalResult['id'], | 35 'targetId': evalResult['id'], |
35 }; | 36 }; |
36 var result = await isolate.invokeRpcNoUpgrade('_getRetainedSize', params); | 37 var result = await isolate.invokeRpcNoUpgrade('_getRetainedSize', params); |
37 expect(result['type'], equals('@Instance')); | 38 expect(result['type'], equals('@Instance')); |
38 expect(result['kind'], equals('Int')); | 39 expect(result['kind'], equals('Int')); |
39 int value1 = int.parse(result['valueAsString']); | 40 int value1 = int.parse(result['valueAsString']); |
40 expect(value1, isPositive); | 41 expect(value1, isPositive); |
41 | 42 |
42 // Two instances of _TestClass retained. | 43 // Two instances of _TestClass retained. |
(...skipping 18 matching lines...) Expand all Loading... |
61 result = await isolate.invokeRpcNoUpgrade('_getRetainedSize', params); | 62 result = await isolate.invokeRpcNoUpgrade('_getRetainedSize', params); |
62 expect(result['type'], equals('@Instance')); | 63 expect(result['type'], equals('@Instance')); |
63 expect(result['kind'], equals('Int')); | 64 expect(result['kind'], equals('Int')); |
64 int value3 = int.parse(result['valueAsString']); | 65 int value3 = int.parse(result['valueAsString']); |
65 expect(value3, isPositive); | 66 expect(value3, isPositive); |
66 expect(value3, equals(value2)); | 67 expect(value3, equals(value2)); |
67 }, | 68 }, |
68 ]; | 69 ]; |
69 | 70 |
70 main(args) async => runIsolateTests(args, tests); | 71 main(args) async => runIsolateTests(args, tests); |
OLD | NEW |