| 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=--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 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
| 9 import 'dart:async'; | |
| 10 | 9 |
| 11 genRepeater(value) { | 10 genRepeater(value) { |
| 12 return () => print(value); | 11 return () => print(value); |
| 13 } | 12 } |
| 14 | 13 |
| 15 genRepeaterNamed(value) { | 14 genRepeaterNamed(value) { |
| 16 return ({x, y}) => print(value); | 15 return ({x, y}) => print(value); |
| 17 } | 16 } |
| 18 | 17 |
| 19 var r1; | 18 var r1; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 } | 63 } |
| 65 }); | 64 }); |
| 66 | 65 |
| 67 valueOfField(String name) async { | 66 valueOfField(String name) async { |
| 68 var field = rootLib.variables.singleWhere((v) => v.name == name); | 67 var field = rootLib.variables.singleWhere((v) => v.name == name); |
| 69 await field.load(); | 68 await field.load(); |
| 70 return field.staticValue; | 69 return field.staticValue; |
| 71 | 70 |
| 72 } | 71 } |
| 73 var r1Ref = await valueOfField('r1'); | 72 var r1Ref = await valueOfField('r1'); |
| 74 var r2Ref = await valueOfField('r2'); | |
| 75 var r3Ref = await valueOfField('r3'); | |
| 76 | 73 |
| 77 var bpt1 = await isolate.addBreakOnActivation(r1Ref); | 74 var bpt1 = await isolate.addBreakOnActivation(r1Ref); |
| 78 print("Added breakpoint $bpt1"); | 75 print("Added breakpoint $bpt1"); |
| 79 expect(bpt1 is Breakpoint, isTrue); | 76 expect(bpt1 is Breakpoint, isTrue); |
| 80 expect(breaksHit, equals(0)); | 77 expect(breaksHit, equals(0)); |
| 81 print("testeeDo()"); | 78 print("testeeDo()"); |
| 82 var res = await rootLib.evaluate("testeeDo()"); | 79 var res = await rootLib.evaluate("testeeDo()"); |
| 83 expect(res is Instance, isTrue); // Not error. | 80 expect(res is Instance, isTrue); // Not error. |
| 84 expect(breaksHit, equals(1)); | 81 expect(breaksHit, equals(1)); |
| 85 | 82 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 106 isolate.resume(); | 103 isolate.resume(); |
| 107 } | 104 } |
| 108 }); | 105 }); |
| 109 | 106 |
| 110 valueOfField(String name) async { | 107 valueOfField(String name) async { |
| 111 var field = rootLib.variables.singleWhere((v) => v.name == name); | 108 var field = rootLib.variables.singleWhere((v) => v.name == name); |
| 112 await field.load(); | 109 await field.load(); |
| 113 return field.staticValue; | 110 return field.staticValue; |
| 114 } | 111 } |
| 115 var r1Ref = await valueOfField('r1_named'); | 112 var r1Ref = await valueOfField('r1_named'); |
| 116 var r2Ref = await valueOfField('r2_named'); | |
| 117 var r3Ref = await valueOfField('r3_named'); | |
| 118 | 113 |
| 119 var bpt1 = await isolate.addBreakOnActivation(r1Ref); | 114 var bpt1 = await isolate.addBreakOnActivation(r1Ref); |
| 120 print("Added breakpoint $bpt1"); | 115 print("Added breakpoint $bpt1"); |
| 121 expect(bpt1 is Breakpoint, isTrue); | 116 expect(bpt1 is Breakpoint, isTrue); |
| 122 expect(breaksHit, equals(0)); | 117 expect(breaksHit, equals(0)); |
| 123 print("testeeDoNamed()"); | 118 print("testeeDoNamed()"); |
| 124 var res = await rootLib.evaluate("testeeDoNamed()"); | 119 var res = await rootLib.evaluate("testeeDoNamed()"); |
| 125 expect(res is Instance, isTrue); // Not error. | 120 expect(res is Instance, isTrue); // Not error. |
| 126 expect(breaksHit, equals(1)); | 121 expect(breaksHit, equals(1)); |
| 127 | 122 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 149 } | 144 } |
| 150 }); | 145 }); |
| 151 | 146 |
| 152 valueOfField(String name) async { | 147 valueOfField(String name) async { |
| 153 var field = rootLib.variables.singleWhere((v) => v.name == name); | 148 var field = rootLib.variables.singleWhere((v) => v.name == name); |
| 154 await field.load(); | 149 await field.load(); |
| 155 return field.staticValue; | 150 return field.staticValue; |
| 156 } | 151 } |
| 157 var r1Ref = await valueOfField('r1'); | 152 var r1Ref = await valueOfField('r1'); |
| 158 var r2Ref = await valueOfField('r2'); | 153 var r2Ref = await valueOfField('r2'); |
| 159 var r3Ref = await valueOfField('r3'); | |
| 160 | 154 |
| 161 var bpt1 = await isolate.addBreakOnActivation(r1Ref); | 155 var bpt1 = await isolate.addBreakOnActivation(r1Ref); |
| 162 print("Added breakpoint $bpt1"); | 156 print("Added breakpoint $bpt1"); |
| 163 expect(bpt1 is Breakpoint, isTrue); | 157 expect(bpt1 is Breakpoint, isTrue); |
| 164 expect(breaksHit, equals(0)); | 158 expect(breaksHit, equals(0)); |
| 165 print("testeeDo()"); | 159 print("testeeDo()"); |
| 166 var res = await rootLib.evaluate("testeeDo()"); | 160 var res = await rootLib.evaluate("testeeDo()"); |
| 167 expect(res is Instance, isTrue); // Not error. | 161 expect(res is Instance, isTrue); // Not error. |
| 168 expect(breaksHit, equals(1)); | 162 expect(breaksHit, equals(1)); |
| 169 | 163 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 189 res = await rootLib.evaluate("testeeDo()"); | 183 res = await rootLib.evaluate("testeeDo()"); |
| 190 expect(res is Instance, isTrue); // Not error. | 184 expect(res is Instance, isTrue); // Not error. |
| 191 expect(breaksHit, equals(4)); | 185 expect(breaksHit, equals(4)); |
| 192 | 186 |
| 193 await subscription.cancel(); | 187 await subscription.cancel(); |
| 194 }, | 188 }, |
| 195 | 189 |
| 196 ]; | 190 ]; |
| 197 | 191 |
| 198 main(args) => runIsolateTests(args, tests, testeeBefore: testeeSetup); | 192 main(args) => runIsolateTests(args, tests, testeeBefore: testeeSetup); |
| OLD | NEW |