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 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 Future _compileSuite(String dartPath) { | 324 Future _compileSuite(String dartPath) { |
325 return _compileFutures.putIfAbsent(dartPath, () { | 325 return _compileFutures.putIfAbsent(dartPath, () { |
326 var dir = new Directory(_compiledDir).createTempSync('test_').path; | 326 var dir = new Directory(_compiledDir).createTempSync('test_').path; |
327 var jsPath = p.join(dir, p.basename(dartPath) + ".js"); | 327 var jsPath = p.join(dir, p.basename(dartPath) + ".js"); |
328 | 328 |
329 return _compilers.compile(dartPath, jsPath, packageRoot: _packageRoot) | 329 return _compilers.compile(dartPath, jsPath, packageRoot: _packageRoot) |
330 .then((_) { | 330 .then((_) { |
331 if (_closed) return; | 331 if (_closed) return; |
332 | 332 |
333 _jsHandler.add( | 333 _jsHandler.add( |
334 p.relative(dartPath, from: _root) + '.browser_test.dart.js', | 334 p.toUri(p.relative(dartPath, from: _root)).path + |
| 335 '.browser_test.dart.js', |
335 (request) { | 336 (request) { |
336 return new shelf.Response.ok(new File(jsPath).readAsStringSync(), | 337 return new shelf.Response.ok(new File(jsPath).readAsStringSync(), |
337 headers: {'Content-Type': 'application/javascript'}); | 338 headers: {'Content-Type': 'application/javascript'}); |
338 }); | 339 }); |
339 }); | 340 }); |
340 }); | 341 }); |
341 } | 342 } |
342 | 343 |
343 /// Returns the [BrowserManager] for [platform], which should be a browser. | 344 /// Returns the [BrowserManager] for [platform], which should be a browser. |
344 /// | 345 /// |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 if (_pubServeUrl == null) { | 415 if (_pubServeUrl == null) { |
415 new Directory(_compiledDir).deleteSync(recursive: true); | 416 new Directory(_compiledDir).deleteSync(recursive: true); |
416 } else { | 417 } else { |
417 _http.close(); | 418 _http.close(); |
418 } | 419 } |
419 | 420 |
420 _closeCompleter.complete(); | 421 _closeCompleter.complete(); |
421 }).catchError(_closeCompleter.completeError); | 422 }).catchError(_closeCompleter.completeError); |
422 } | 423 } |
423 } | 424 } |
OLD | NEW |