| 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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 suiteUrl = url.resolveUri(p.toUri( | 290 suiteUrl = url.resolveUri(p.toUri( |
| 291 p.withoutExtension(p.relative(path, from: _root)) + ".html")); | 291 p.withoutExtension(p.relative(path, from: _root)) + ".html")); |
| 292 } | 292 } |
| 293 | 293 |
| 294 if (_closed) return null; | 294 if (_closed) return null; |
| 295 | 295 |
| 296 // TODO(nweiz): Don't start the browser until all the suites are compiled. | 296 // TODO(nweiz): Don't start the browser until all the suites are compiled. |
| 297 var browserManager = await _browserManagerFor(browser); | 297 var browserManager = await _browserManagerFor(browser); |
| 298 if (_closed) return null; | 298 if (_closed) return null; |
| 299 | 299 |
| 300 var suite; | |
| 301 if (browserManager != null) { | 300 if (browserManager != null) { |
| 302 suite = await browserManager.loadSuite(path, suiteUrl, metadata, | 301 var suite = await browserManager.loadSuite(path, suiteUrl, metadata, |
| 303 mapper: browser.isJS ? _mappers[path] : null); | 302 mapper: browser.isJS ? _mappers[path] : null); |
| 304 if (_closed) return null; | 303 if (_closed) return null; |
| 304 if (suite != null) return suite; |
| 305 } | 305 } |
| 306 | 306 |
| 307 if (suite != null) return suite.change(platform: browser.name); | |
| 308 | |
| 309 // If the browser manager fails to load a suite and the server isn't | 307 // If the browser manager fails to load a suite and the server isn't |
| 310 // closed, it's probably because the browser failed. We emit the failure | 308 // closed, it's probably because the browser failed. We emit the failure |
| 311 // here to ensure that it gets surfaced. | 309 // here to ensure that it gets surfaced. |
| 312 return _browsers[browser].onExit; | 310 return _browsers[browser].onExit; |
| 313 } | 311 } |
| 314 | 312 |
| 315 /// Loads a test suite at [path] from the `pub serve` URL [jsUrl]. | 313 /// Loads a test suite at [path] from the `pub serve` URL [jsUrl]. |
| 316 /// | 314 /// |
| 317 /// This ensures that only one suite is loaded at a time, and that any errors | 315 /// This ensures that only one suite is loaded at a time, and that any errors |
| 318 /// are exposed as [LoadException]s. | 316 /// are exposed as [LoadException]s. |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 481 await Future.wait(futures); | 479 await Future.wait(futures); |
| 482 | 480 |
| 483 if (_pubServeUrl == null) { | 481 if (_pubServeUrl == null) { |
| 484 new Directory(_compiledDir).deleteSync(recursive: true); | 482 new Directory(_compiledDir).deleteSync(recursive: true); |
| 485 } else { | 483 } else { |
| 486 _http.close(); | 484 _http.close(); |
| 487 } | 485 } |
| 488 }); | 486 }); |
| 489 } | 487 } |
| 490 } | 488 } |
| OLD | NEW |