| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 }); | 322 }); |
| 323 } | 323 } |
| 324 | 324 |
| 325 /// Compile the test suite at [dartPath] to JavaScript. | 325 /// Compile the test suite at [dartPath] to JavaScript. |
| 326 /// | 326 /// |
| 327 /// Once the suite has been compiled, it's added to [_jsHandler] so it can be | 327 /// Once the suite has been compiled, it's added to [_jsHandler] so it can be |
| 328 /// served. | 328 /// served. |
| 329 Future _compileSuite(String dartPath) { | 329 Future _compileSuite(String dartPath) { |
| 330 return _compileFutures.putIfAbsent(dartPath, () async { | 330 return _compileFutures.putIfAbsent(dartPath, () async { |
| 331 var dir = new Directory(_compiledDir).createTempSync('test_').path; | 331 var dir = new Directory(_compiledDir).createTempSync('test_').path; |
| 332 var jsPath = p.join(dir, p.basename(dartPath) + ".js"); | 332 var jsPath = p.join(dir, p.basename(dartPath) + ".browser_test.dart.js"); |
| 333 | 333 |
| 334 await _compilers.compile(dartPath, jsPath, | 334 await _compilers.compile(dartPath, jsPath, |
| 335 packageRoot: _config.packageRoot); | 335 packageRoot: _config.packageRoot); |
| 336 if (_closed) return; | 336 if (_closed) return; |
| 337 | 337 |
| 338 var jsUrl = p.toUri(p.relative(dartPath, from: _root)).path + | 338 var jsUrl = p.toUri(p.relative(dartPath, from: _root)).path + |
| 339 '.browser_test.dart.js'; | 339 '.browser_test.dart.js'; |
| 340 _jsHandler.add(jsUrl, (request) { | 340 _jsHandler.add(jsUrl, (request) { |
| 341 return new shelf.Response.ok(new File(jsPath).readAsStringSync(), | 341 return new shelf.Response.ok(new File(jsPath).readAsStringSync(), |
| 342 headers: {'Content-Type': 'application/javascript'}); | 342 headers: {'Content-Type': 'application/javascript'}); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 await Future.wait(futures); | 406 await Future.wait(futures); |
| 407 | 407 |
| 408 if (_config.pubServeUrl == null) { | 408 if (_config.pubServeUrl == null) { |
| 409 new Directory(_compiledDir).deleteSync(recursive: true); | 409 new Directory(_compiledDir).deleteSync(recursive: true); |
| 410 } else { | 410 } else { |
| 411 _http.close(); | 411 _http.close(); |
| 412 } | 412 } |
| 413 }); | 413 }); |
| 414 } | 414 } |
| 415 } | 415 } |
| OLD | NEW |