Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Side by Side Diff: lib/src/runner/loader.dart

Issue 1101773002: Add Windows support. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Unused import Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/runner/browser/server.dart ('k') | lib/src/util/io.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4
5 library test.runner.loader; 5 library test.runner.loader;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 10
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 if (_pubServeUrl != null) { 175 if (_pubServeUrl != null) {
176 var url = _pubServeUrl.resolve( 176 var url = _pubServeUrl.resolve(
177 p.relative(path, from: 'test') + '.vm_test.dart'); 177 p.relative(path, from: 'test') + '.vm_test.dart');
178 return Isolate.spawnUri(url, [], { 178 return Isolate.spawnUri(url, [], {
179 'reply': receivePort.sendPort, 179 'reply': receivePort.sendPort,
180 'metadata': metadata.serialize() 180 'metadata': metadata.serialize()
181 }).then((isolate) => new IsolateWrapper(isolate, () {})) 181 }).then((isolate) => new IsolateWrapper(isolate, () {}))
182 .catchError((error, stackTrace) { 182 .catchError((error, stackTrace) {
183 if (error is! IsolateSpawnException) throw error; 183 if (error is! IsolateSpawnException) throw error;
184 184
185 if (error.message.contains("OS Error: Connection refused")) { 185 if (error.message.contains("OS Error: Connection refused") ||
186 error.message.contains("The remote computer refused")) {
186 throw new LoadException(path, 187 throw new LoadException(path,
187 "Error getting $url: Connection refused\n" 188 "Error getting $url: Connection refused\n"
188 'Make sure "pub serve" is running.'); 189 'Make sure "pub serve" is running.');
189 } else if (error.message.contains("404 Not Found")) { 190 } else if (error.message.contains("404 Not Found")) {
190 throw new LoadException(path, 191 throw new LoadException(path,
191 "Error getting $url: 404 Not Found\n" 192 "Error getting $url: 404 Not Found\n"
192 'Make sure "pub serve" is serving the test/ directory.'); 193 'Make sure "pub serve" is serving the test/ directory.');
193 } 194 }
194 195
195 throw new LoadException(path, error); 196 throw new LoadException(path, error);
196 }); 197 });
197 } else { 198 } else {
198 return runInIsolate(''' 199 return runInIsolate('''
199 import "package:test/src/backend/metadata.dart"; 200 import "package:test/src/backend/metadata.dart";
200 import "package:test/src/runner/vm/isolate_listener.dart"; 201 import "package:test/src/runner/vm/isolate_listener.dart";
201 202
202 import "${p.toUri(p.absolute(path))}" as test; 203 import "${p.toUri(p.absolute(path))}" as test;
203 204
204 void main(_, Map message) { 205 void main(_, Map message) {
205 var sendPort = message['reply']; 206 var sendPort = message['reply'];
206 var metadata = new Metadata.deserialize(message['metadata']); 207 var metadata = new Metadata.deserialize(message['metadata']);
207 IsolateListener.start(sendPort, metadata, () => test.main); 208 IsolateListener.start(sendPort, metadata, () => test.main);
208 } 209 }
209 ''', { 210 ''', {
210 'reply': receivePort.sendPort, 211 'reply': receivePort.sendPort,
211 'metadata': metadata.serialize() 212 'metadata': metadata.serialize()
212 }, packageRoot: _packageRoot); 213 }, packageRoot: p.toUri(_packageRoot));
213 } 214 }
214 }).catchError((error, stackTrace) { 215 }).catchError((error, stackTrace) {
215 receivePort.close(); 216 receivePort.close();
216 if (error is LoadException) throw error; 217 if (error is LoadException) throw error;
217 return new Future.error(new LoadException(path, error), stackTrace); 218 return new Future.error(new LoadException(path, error), stackTrace);
218 }).then((isolate) { 219 }).then((isolate) {
219 _isolates.add(isolate); 220 _isolates.add(isolate);
220 return receivePort.first; 221 return receivePort.first;
221 }).then((response) { 222 }).then((response) {
222 if (response["type"] == "loadException") { 223 if (response["type"] == "loadException") {
(...skipping 16 matching lines...) Expand all
239 Future close() { 240 Future close() {
240 for (var isolate in _isolates) { 241 for (var isolate in _isolates) {
241 isolate.kill(); 242 isolate.kill();
242 } 243 }
243 _isolates.clear(); 244 _isolates.clear();
244 245
245 if (_browserServerCompleter == null) return new Future.value(); 246 if (_browserServerCompleter == null) return new Future.value();
246 return _browserServer.then((browserServer) => browserServer.close()); 247 return _browserServer.then((browserServer) => browserServer.close());
247 } 248 }
248 } 249 }
OLDNEW
« no previous file with comments | « lib/src/runner/browser/server.dart ('k') | lib/src/util/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698