OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 'dart:async'; | 6 import 'dart:async'; |
7 import 'dart:developer' as dev; | 7 import 'dart:developer' as dev; |
8 import 'dart:isolate' as Core; | 8 import 'dart:isolate' as Core; |
9 | 9 |
10 import 'package:observatory/service_io.dart' as Service; | 10 import 'package:observatory/service_io.dart' as Service; |
11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
12 import 'service_test_common.dart'; | 12 import 'service_test_common.dart'; |
13 import 'test_helper.dart'; | 13 import 'test_helper.dart'; |
14 | 14 |
| 15 |
15 // testee state. | 16 // testee state. |
16 String selfId; | 17 String selfId; |
17 Core.Isolate childIsolate; | 18 Core.Isolate childIsolate; |
18 String childId; | 19 String childId; |
19 | 20 |
20 void spawnEntry(int i) { | 21 void spawnEntry(int i) { |
21 dev.debugger(); | 22 dev.debugger(); |
22 } | 23 } |
23 | 24 |
24 Future testeeMain() async { | 25 Future testeeMain() async { |
(...skipping 23 matching lines...) Expand all Loading... |
48 (Service.VM vm) async { | 49 (Service.VM vm) async { |
49 // Initial isolate has paused at second debugger call. | 50 // Initial isolate has paused at second debugger call. |
50 await hasStoppedAtBreakpoint(initialIsolate); | 51 await hasStoppedAtBreakpoint(initialIsolate); |
51 }, | 52 }, |
52 (Service.VM vm) async { | 53 (Service.VM vm) async { |
53 // Reload the VM. | 54 // Reload the VM. |
54 await vm.reload(); | 55 await vm.reload(); |
55 | 56 |
56 // Grab the child isolate. | 57 // Grab the child isolate. |
57 localChildIsolate = | 58 localChildIsolate = |
58 vm.isolates.firstWhere((Service.Isolate i) => i != initialIsolate); | 59 vm.isolates.firstWhere( |
| 60 (Service.Isolate i) => i != initialIsolate); |
59 expect(localChildIsolate, isNotNull); | 61 expect(localChildIsolate, isNotNull); |
60 | 62 |
61 // Reload the initial isolate. | 63 // Reload the initial isolate. |
62 await initialIsolate.reload(); | 64 await initialIsolate.reload(); |
63 | 65 |
64 // Grab the root library. | 66 // Grab the root library. |
65 Service.Library rootLbirary = await initialIsolate.rootLibrary.load(); | 67 Service.Library rootLbirary = await initialIsolate.rootLibrary.load(); |
66 | 68 |
67 // Grab self id. | 69 // Grab self id. |
68 Service.Instance localSelfId = | 70 Service.Instance localSelfId = |
69 await initialIsolate.eval(rootLbirary, 'selfId'); | 71 await initialIsolate.eval(rootLbirary, 'selfId'); |
70 | 72 |
71 // Check that the id reported from dart:developer matches the id reported | 73 // Check that the id reported from dart:developer matches the id reported |
72 // from the service protocol. | 74 // from the service protocol. |
73 expect(localSelfId.isString, true); | 75 expect(localSelfId.isString, true); |
74 expect(initialIsolate.id, equals(localSelfId.valueAsString)); | 76 expect(initialIsolate.id, equals(localSelfId.valueAsString)); |
75 | 77 |
76 // Grab the child isolate's id. | 78 // Grab the child isolate's id. |
77 Service.Instance localChildId = | 79 Service.Instance localChildId = |
78 await initialIsolate.eval(rootLbirary, 'childId'); | 80 await initialIsolate.eval(rootLbirary, 'childId'); |
79 | 81 |
80 // Check that the id reported from dart:developer matches the id reported | 82 // Check that the id reported from dart:developer matches the id reported |
81 // from the service protocol. | 83 // from the service protocol. |
82 expect(localChildId.isString, true); | 84 expect(localChildId.isString, true); |
83 expect(localChildIsolate.id, equals(localChildId.valueAsString)); | 85 expect(localChildIsolate.id, equals(localChildId.valueAsString)); |
84 } | 86 } |
85 ]; | 87 ]; |
86 | 88 |
87 main(args) async => runVMTests(args, tests, testeeConcurrent: testeeMain); | 89 main(args) async => runVMTests(args, tests, |
| 90 testeeConcurrent: testeeMain); |
OLD | NEW |