OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 | 4 |
5 library vmservice_test_helper; | 5 library vmservice_test_helper; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 Future onRequestCompleted(Map response); | 73 Future onRequestCompleted(Map response); |
74 } | 74 } |
75 | 75 |
76 class TestLauncher { | 76 class TestLauncher { |
77 final String script; | 77 final String script; |
78 Process process; | 78 Process process; |
79 | 79 |
80 TestLauncher(this.script); | 80 TestLauncher(this.script); |
81 | 81 |
82 String get scriptPath { | 82 String get scriptPath { |
83 var dartScript = Platform.script.toFilePath(); | 83 var dartScript = Platform.script; |
84 var splitPoint = dartScript.lastIndexOf(Platform.pathSeparator); | 84 var splitPoint = dartScript.lastIndexOf(Platform.pathSeparator); |
85 var scriptDirectory = dartScript.substring(0, splitPoint); | 85 var scriptDirectory = dartScript.substring(0, splitPoint); |
86 return scriptDirectory + Platform.pathSeparator + script; | 86 return scriptDirectory + Platform.pathSeparator + script; |
87 } | 87 } |
88 | 88 |
89 Future<int> launch() { | 89 Future<int> launch() { |
90 String dartExecutable = Platform.executable; | 90 String dartExecutable = Platform.executable; |
91 print('** Launching $scriptPath'); | 91 print('** Launching $scriptPath'); |
92 return Process.start(dartExecutable, | 92 return Process.start(dartExecutable, |
93 ['--enable-vm-service:0', scriptPath]).then((p) { | 93 ['--enable-vm-service:0', scriptPath]).then((p) { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 }); | 247 }); |
248 }); | 248 }); |
249 return Future.wait(requests).then((a) { | 249 return Future.wait(requests).then((a) { |
250 a.forEach((FieldRequestHelper field) { | 250 a.forEach((FieldRequestHelper field) { |
251 fields[field.field['user_name']] = field.field; | 251 fields[field.field['user_name']] = field.field; |
252 }); | 252 }); |
253 return this; | 253 return this; |
254 }); | 254 }); |
255 } | 255 } |
256 } | 256 } |
OLD | NEW |