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

Side by Side Diff: lib/pub_serve.dart

Issue 1704773002: Load web tests using the plugin infrastructure. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 10 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 | « no previous file | lib/src/runner.dart » ('j') | lib/src/runner/browser/browser_manager.dart » ('J')
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 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
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 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/runner.dart » ('j') | lib/src/runner/browser/browser_manager.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698