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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 var channel = serializeSuite(() { | 42 var channel = serializeSuite(() { |
43 catchIsolateErrors(); | 43 catchIsolateErrors(); |
44 return test.main; | 44 return test.main; |
45 }); | 45 }); |
46 new IsolateChannel.connectSend(message).pipe(channel); | 46 new IsolateChannel.connectSend(message).pipe(channel); |
47 } | 47 } |
48 ''')); | 48 ''')); |
49 | 49 |
50 transform.addOutput( | 50 transform.addOutput( |
51 new Asset.fromString(id.addExtension('.browser_test.dart'), ''' | 51 new Asset.fromString(id.addExtension('.browser_test.dart'), ''' |
52 import "package:test/src/runner/browser/iframe_listener.dart"; | 52 import "package:stream_channel/stream_channel.dart"; |
53 | 53 |
54 import "${p.url.basename(id.path)}" as test; | 54 import "package:test/src/runner/plugin/remote_platform_helpers.dart"; |
| 55 import "package:test/src/runner/browser/post_message_channel.dart"; |
55 | 56 |
56 void main() { | 57 import "${p.url.basename(id.path)}" as test; |
57 IframeListener.start(() => test.main); | 58 |
58 } | 59 void main() { |
59 ''')); | 60 var channel = serializeSuite(() => test.main); |
| 61 postMessageChannel().pipe(channel); |
| 62 } |
| 63 ''')); |
60 | 64 |
61 // If the user has their own HTML file for the test, let that take | 65 // If the user has their own HTML file for the test, let that take |
62 // precedence. Otherwise, create our own basic file. | 66 // precedence. Otherwise, create our own basic file. |
63 var htmlId = id.changeExtension('.html'); | 67 var htmlId = id.changeExtension('.html'); |
64 if (await transform.hasInput(htmlId)) return; | 68 if (await transform.hasInput(htmlId)) return; |
65 | 69 |
66 transform.addOutput( | 70 transform.addOutput( |
67 new Asset.fromString(htmlId, ''' | 71 new Asset.fromString(htmlId, ''' |
68 <!DOCTYPE html> | 72 <!DOCTYPE html> |
69 <html> | 73 <html> |
70 <head> | 74 <head> |
71 <title>${HTML_ESCAPE.convert(id.path)} Test</title> | 75 <title>${HTML_ESCAPE.convert(id.path)} Test</title> |
72 <link rel="x-dart-test" href="${HTML_ESCAPE.convert(p.url.basename(id.path))}"
> | 76 <link rel="x-dart-test" |
73 <script src="packages/test/dart.js"></script> | 77 href="${HTML_ESCAPE.convert(p.url.basename(id.path))}"> |
74 </head> | 78 <script src="packages/test/dart.js"></script> |
75 </html> | 79 </head> |
76 ''')); | 80 </html> |
| 81 ''')); |
77 } | 82 } |
78 } | 83 } |
OLD | NEW |