| 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 | 4 |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
| 7 | 7 |
| 8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
| 9 import 'package:stream_channel/stream_channel.dart'; | 9 import 'package:stream_channel/stream_channel.dart'; |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 import "${p.toUri(p.absolute(path))}" as test; | 63 import "${p.toUri(p.absolute(path))}" as test; |
| 64 | 64 |
| 65 void main(_, SendPort message) { | 65 void main(_, SendPort message) { |
| 66 var channel = serializeSuite(() { | 66 var channel = serializeSuite(() { |
| 67 catchIsolateErrors(); | 67 catchIsolateErrors(); |
| 68 return test.main; | 68 return test.main; |
| 69 }); | 69 }); |
| 70 new IsolateChannel.connectSend(message).pipe(channel); | 70 new IsolateChannel.connectSend(message).pipe(channel); |
| 71 } | 71 } |
| 72 ''', message, packageRoot: p.toUri(_config.packageRoot), checked: true); | 72 ''', message, checked: true); |
| 73 } | 73 } |
| 74 | 74 |
| 75 var url = _config.pubServeUrl.resolveUri( | 75 var url = _config.pubServeUrl.resolveUri( |
| 76 p.toUri(p.relative(path, from: 'test') + '.vm_test.dart')); | 76 p.toUri(p.relative(path, from: 'test') + '.vm_test.dart')); |
| 77 | 77 |
| 78 try { | 78 try { |
| 79 return await Isolate.spawnUri(url, [], message, checked: true); | 79 return await Isolate.spawnUri(url, [], message, checked: true); |
| 80 } on IsolateSpawnException catch (error) { | 80 } on IsolateSpawnException catch (error) { |
| 81 if (error.message.contains("OS Error: Connection refused") || | 81 if (error.message.contains("OS Error: Connection refused") || |
| 82 error.message.contains("The remote computer refused")) { | 82 error.message.contains("The remote computer refused")) { |
| 83 throw new LoadException(path, | 83 throw new LoadException(path, |
| 84 "Error getting $url: Connection refused\n" | 84 "Error getting $url: Connection refused\n" |
| 85 'Make sure "pub serve" is running.'); | 85 'Make sure "pub serve" is running.'); |
| 86 } else if (error.message.contains("404 Not Found")) { | 86 } else if (error.message.contains("404 Not Found")) { |
| 87 throw new LoadException(path, | 87 throw new LoadException(path, |
| 88 "Error getting $url: 404 Not Found\n" | 88 "Error getting $url: 404 Not Found\n" |
| 89 'Make sure "pub serve" is serving the test/ directory.'); | 89 'Make sure "pub serve" is serving the test/ directory.'); |
| 90 } | 90 } |
| 91 | 91 |
| 92 throw new LoadException(path, error); | 92 throw new LoadException(path, error); |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 } | 95 } |
| OLD | NEW |