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

Side by Side Diff: lib/src/runner/browser/server.dart

Issue 1098763004: Fix running browser tests in subdirectories and release 0.12.0-beta.10. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 8 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 | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
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 library test.runner.browser.server; 5 library test.runner.browser.server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 10
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 IframeListener.start(() => test.main); 199 IframeListener.start(() => test.main);
200 } 200 }
201 ''', headers: {'Content-Type': 'application/dart'}); 201 ''', headers: {'Content-Type': 'application/dart'});
202 } 202 }
203 203
204 if (path.endsWith(".html")) { 204 if (path.endsWith(".html")) {
205 var test = p.withoutExtension(path) + ".dart"; 205 var test = p.withoutExtension(path) + ".dart";
206 206
207 // Link to the Dart wrapper on Dartium and the compiled JS version 207 // Link to the Dart wrapper on Dartium and the compiled JS version
208 // elsewhere. 208 // elsewhere.
209 var scriptBase =
210 "${HTML_ESCAPE.convert(p.basename(test))}.browser_test.dart";
209 var script = request.headers['user-agent'].contains('(Dart)') 211 var script = request.headers['user-agent'].contains('(Dart)')
210 ? 'type="application/dart" ' 212 ? 'type="application/dart" src="$scriptBase"'
211 'src="${HTML_ESCAPE.convert(test)}.browser_test.dart"' 213 : 'src="$scriptBase.js"';
212 : 'src="${HTML_ESCAPE.convert(test)}.browser_test.dart.js"';
213 214
214 return new shelf.Response.ok(''' 215 return new shelf.Response.ok('''
215 <!DOCTYPE html> 216 <!DOCTYPE html>
216 <html> 217 <html>
217 <head> 218 <head>
218 <title>${HTML_ESCAPE.convert(test)} Test</title> 219 <title>${HTML_ESCAPE.convert(test)} Test</title>
219 <script $script></script> 220 <script $script></script>
220 </head> 221 </head>
221 </html> 222 </html>
222 ''', headers: {'Content-Type': 'text/html'}); 223 ''', headers: {'Content-Type': 'text/html'});
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 if (_pubServeUrl == null) { 414 if (_pubServeUrl == null) {
414 new Directory(_compiledDir).deleteSync(recursive: true); 415 new Directory(_compiledDir).deleteSync(recursive: true);
415 } else { 416 } else {
416 _http.close(); 417 _http.close();
417 } 418 }
418 419
419 _closeCompleter.complete(); 420 _closeCompleter.complete();
420 }).catchError(_closeCompleter.completeError); 421 }).catchError(_closeCompleter.completeError);
421 } 422 }
422 } 423 }
OLDNEW
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698