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