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 'test_helper.dart'; | 6 import 'test_helper.dart'; |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:developer'; | 8 import 'dart:developer'; |
9 import 'dart:isolate' as I; | 9 import 'dart:isolate' as I; |
10 import 'dart:io'; | 10 import 'dart:io'; |
11 import 'service_test_common.dart'; | 11 import 'service_test_common.dart'; |
12 import 'package:observatory/service.dart'; | 12 import 'package:observatory/service.dart'; |
13 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
14 | 14 |
15 testMain() async { | 15 testMain() async { |
16 debugger(); // Stop here. | 16 debugger(); // Stop here. |
17 // Spawn the child isolate. | 17 // Spawn the child isolate. |
18 I.Isolate isolate = | 18 I.Isolate isolate = |
19 await I.Isolate.spawnUri(Uri.parse('complex_reload/v1/main.dart'), | 19 await I.Isolate.spawnUri(Uri.parse('complex_reload/v1/main.dart'), |
20 [], | 20 [], |
21 null); | 21 null); |
22 print(isolate); | 22 print(isolate); |
23 debugger(); | 23 debugger(); |
24 } | 24 } |
25 | 25 |
26 // Directory that we are running in. | 26 // Directory that we are running in. |
27 String directory = Platform.pathSeparator + | 27 String directory = (Platform.isWindows ? '' : Platform.pathSeparator) + |
28 Platform.script.pathSegments.sublist( | 28 Platform.script.pathSegments.sublist( |
29 0, | 29 0, |
30 Platform.script.pathSegments.length - 1).join(Platform.pathSeparator); | 30 Platform.script.pathSegments.length - 1).join(Platform.pathSeparator); |
31 | 31 |
32 Future<String> invokeTest(Isolate isolate) async { | 32 Future<String> invokeTest(Isolate isolate) async { |
33 await isolate.reload(); | 33 await isolate.reload(); |
34 Library lib = isolate.rootLibrary; | 34 Library lib = isolate.rootLibrary; |
35 await lib.load(); | 35 await lib.load(); |
36 Instance result = await lib.evaluate('test()'); | 36 Instance result = await lib.evaluate('test()'); |
37 expect(result.isString, isTrue); | 37 expect(result.isString, isTrue); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 ); | 76 ); |
77 expect(response['success'], isTrue); | 77 expect(response['success'], isTrue); |
78 | 78 |
79 // Invoke test in v3. | 79 // Invoke test in v3. |
80 String v3 = await invokeTest(slaveIsolate); | 80 String v3 = await invokeTest(slaveIsolate); |
81 expect(v3, 'cabbage'); | 81 expect(v3, 'cabbage'); |
82 } | 82 } |
83 ]; | 83 ]; |
84 | 84 |
85 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 85 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
OLD | NEW |