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