| 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 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'dart:developer'; | 7 import 'dart:developer'; |
| 8 import 'package:observatory/service_io.dart'; | 8 import 'package:observatory/service_io.dart'; |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 import 'service_test_common.dart'; |
| 10 import 'test_helper.dart'; | 11 import 'test_helper.dart'; |
| 11 | 12 |
| 12 int count = 0; | 13 int count = 0; |
| 13 | 14 |
| 14 void test() { | 15 void test() { |
| 15 while (true) { | 16 while (true) { |
| 16 count++; | 17 count++; |
| 17 debugger(); | 18 debugger(); |
| 18 } | 19 } |
| 19 } | 20 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 newIsolate.rootLibrary.evaluate('count').then((result) { | 63 newIsolate.rootLibrary.evaluate('count').then((result) { |
| 63 expect(result.type, equals('Instance')); | 64 expect(result.type, equals('Instance')); |
| 64 expect(result.valueAsString, equals('1')); | 65 expect(result.valueAsString, equals('1')); |
| 65 debugSub.cancel(); | 66 debugSub.cancel(); |
| 66 testCompleter.complete(); | 67 testCompleter.complete(); |
| 67 }); | 68 }); |
| 68 }); | 69 }); |
| 69 } | 70 } |
| 70 } | 71 } |
| 71 }); | 72 }); |
| 72 | 73 |
| 73 Completer restartCompleter = new Completer(); | 74 Completer restartCompleter = new Completer(); |
| 74 var isolateStream = await isolate.vm.getEventStream(VM.kIsolateStream); | 75 var isolateStream = await isolate.vm.getEventStream(VM.kIsolateStream); |
| 75 var isolateSub; | 76 var isolateSub; |
| 76 bool exit = false; | 77 bool exit = false; |
| 77 bool start = false; | 78 bool start = false; |
| 78 isolateSub = isolateStream.listen((ServiceEvent event) { | 79 isolateSub = isolateStream.listen((ServiceEvent event) { |
| 79 if (event.kind == ServiceEvent.kIsolateExit) { | 80 if (event.kind == ServiceEvent.kIsolateExit) { |
| 80 expect(event.isolate, equals(isolate)); | 81 expect(event.isolate, equals(isolate)); |
| 81 print('Old isolate exited'); | 82 print('Old isolate exited'); |
| 82 exit = true; | 83 exit = true; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 94 | 95 |
| 95 // Restart the vm. | 96 // Restart the vm. |
| 96 print("restarting"); | 97 print("restarting"); |
| 97 await isolate.vm.restart(); | 98 await isolate.vm.restart(); |
| 98 await restartCompleter.future; | 99 await restartCompleter.future; |
| 99 print("restarted"); | 100 print("restarted"); |
| 100 await testCompleter.future; | 101 await testCompleter.future; |
| 101 }, | 102 }, |
| 102 ]; | 103 ]; |
| 103 | 104 |
| 104 | 105 |
| 105 main(args) => runIsolateTests(args, tests, testeeConcurrent: test); | 106 main(args) => runIsolateTests(args, tests, testeeConcurrent: test); |
| OLD | NEW |