| 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:convert'; | 5 import 'dart:convert'; |
| 6 | 6 |
| 7 import 'package:barback/barback.dart'; | 7 import 'package:barback/barback.dart'; |
| 8 import 'package:path/path.dart' as p; | 8 import 'package:path/path.dart' as p; |
| 9 | 9 |
| 10 /// A transformer that injects bootstrapping code used by the test runner to run | 10 /// A transformer that injects bootstrapping code used by the test runner to run |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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/runner/vm/isolate_listener.dart"; | 32 import "package:test/src/runner/vm/isolate_listener.dart"; |
| 33 | 33 |
| 34 import "${p.url.basename(id.path)}" as test; | 34 import "${p.url.basename(id.path)}" as test; |
| 35 | 35 |
| 36 void main(_, Map message) { | 36 void main(_, Map message) { |
| 37 var sendPort = message['reply']; | 37 var sendPort = message['reply']; |
| 38 IsolateListener.start(sendPort, () => test.main); | 38 var metadata = new Metadata.deserialize(message['metadata']); |
| 39 IsolateListener.start(sendPort, metadata, () => test.main); |
| 39 } | 40 } |
| 40 ''')); | 41 ''')); |
| 41 | 42 |
| 42 var browserId = id.addExtension('.browser_test.dart'); | 43 var browserId = id.addExtension('.browser_test.dart'); |
| 43 transform.addOutput(new Asset.fromString(browserId, ''' | 44 transform.addOutput(new Asset.fromString(browserId, ''' |
| 44 import "package:test/src/runner/browser/iframe_listener.dart"; | 45 import "package:test/src/runner/browser/iframe_listener.dart"; |
| 45 | 46 |
| 46 import "${p.url.basename(id.path)}" as test; | 47 import "${p.url.basename(id.path)}" as test; |
| 47 | 48 |
| 48 void main(_) { | 49 void main(_) { |
| 49 IframeListener.start(() => test.main); | 50 IframeListener.start(() => test.main); |
| 50 } | 51 } |
| 51 ''')); | 52 ''')); |
| 52 | 53 |
| 53 transform.addOutput( | 54 transform.addOutput( |
| 54 new Asset.fromString(id.addExtension('.browser_test.html'), ''' | 55 new Asset.fromString(id.addExtension('.browser_test.html'), ''' |
| 55 <!DOCTYPE html> | 56 <!DOCTYPE html> |
| 56 <html> | 57 <html> |
| 57 <head> | 58 <head> |
| 58 <title>${HTML_ESCAPE.convert(id.path)} Test</title> | 59 <title>${HTML_ESCAPE.convert(id.path)} Test</title> |
| 59 <script src="${HTML_ESCAPE.convert(p.url.basename(browserId.path))}.js"> | 60 <script src="${HTML_ESCAPE.convert(p.url.basename(browserId.path))}.js"> |
| 60 </script> | 61 </script> |
| 61 </head> | 62 </head> |
| 62 </html> | 63 </html> |
| 63 ''')); | 64 ''')); |
| 64 } | 65 } |
| 65 } | 66 } |
| OLD | NEW |