OLD | NEW |
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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 | 7 |
8 import 'package:barback/barback.dart'; | 8 import 'package:barback/barback.dart'; |
9 import 'package:path/path.dart' as p; | 9 import 'package:path/path.dart' as p; |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 var id = transform.primaryId; | 22 var id = transform.primaryId; |
23 transform.declareOutput(id.addExtension('.vm_test.dart')); | 23 transform.declareOutput(id.addExtension('.vm_test.dart')); |
24 transform.declareOutput(id.addExtension('.browser_test.dart')); | 24 transform.declareOutput(id.addExtension('.browser_test.dart')); |
25 } | 25 } |
26 | 26 |
27 Future apply(Transform transform) async { | 27 Future apply(Transform transform) async { |
28 var id = transform.primaryInput.id; | 28 var id = transform.primaryInput.id; |
29 | 29 |
30 transform.addOutput( | 30 transform.addOutput( |
31 new Asset.fromString(id.addExtension('.vm_test.dart'), ''' | 31 new Asset.fromString(id.addExtension('.vm_test.dart'), ''' |
32 import "package:test/src/backend/metadata.dart"; | 32 import "dart:isolate"; |
33 import "package:test/src/runner/vm/isolate_listener.dart"; | |
34 | 33 |
35 import "${p.url.basename(id.path)}" as test; | 34 import "package:stream_channel/stream_channel.dart"; |
36 | 35 |
37 void main(_, Map message) { | 36 import "package:test/src/runner/plugin/remote_platform_helpers.dart"; |
38 var sendPort = message['reply']; | 37 import "package:test/src/runner/vm/catch_isolate_errors.dart"; |
39 var metadata = new Metadata.deserialize(message['metadata']); | 38 |
40 IsolateListener.start(sendPort, metadata, () => test.main); | 39 import "${p.url.basename(id.path)}" as test; |
41 } | 40 |
42 ''')); | 41 void main(_, SendPort message) { |
| 42 var channel = serializeSuite(() { |
| 43 catchIsolateErrors(); |
| 44 return test.main; |
| 45 }); |
| 46 new IsolateChannel.connectSend(message).pipe(channel); |
| 47 } |
| 48 ''')); |
43 | 49 |
44 transform.addOutput( | 50 transform.addOutput( |
45 new Asset.fromString(id.addExtension('.browser_test.dart'), ''' | 51 new Asset.fromString(id.addExtension('.browser_test.dart'), ''' |
46 import "package:test/src/runner/browser/iframe_listener.dart"; | 52 import "package:test/src/runner/browser/iframe_listener.dart"; |
47 | 53 |
48 import "${p.url.basename(id.path)}" as test; | 54 import "${p.url.basename(id.path)}" as test; |
49 | 55 |
50 void main() { | 56 void main() { |
51 IframeListener.start(() => test.main); | 57 IframeListener.start(() => test.main); |
52 } | 58 } |
(...skipping 10 matching lines...) Expand all Loading... |
63 <html> | 69 <html> |
64 <head> | 70 <head> |
65 <title>${HTML_ESCAPE.convert(id.path)} Test</title> | 71 <title>${HTML_ESCAPE.convert(id.path)} Test</title> |
66 <link rel="x-dart-test" href="${HTML_ESCAPE.convert(p.url.basename(id.path))}"
> | 72 <link rel="x-dart-test" href="${HTML_ESCAPE.convert(p.url.basename(id.path))}"
> |
67 <script src="packages/test/dart.js"></script> | 73 <script src="packages/test/dart.js"></script> |
68 </head> | 74 </head> |
69 </html> | 75 </html> |
70 ''')); | 76 ''')); |
71 } | 77 } |
72 } | 78 } |
OLD | NEW |