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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 .then((_) { | 259 .then((_) { |
260 if (_closed) return null; | 260 if (_closed) return null; |
261 return url.resolveUri(p.toUri( | 261 return url.resolveUri(p.toUri( |
262 p.withoutExtension(p.relative(path, from: _root)) + ".html")); | 262 p.withoutExtension(p.relative(path, from: _root)) + ".html")); |
263 }); | 263 }); |
264 }).then((suiteUrl) { | 264 }).then((suiteUrl) { |
265 if (_closed) return null; | 265 if (_closed) return null; |
266 | 266 |
267 // TODO(nweiz): Don't start the browser until all the suites are compiled. | 267 // TODO(nweiz): Don't start the browser until all the suites are compiled. |
268 return _browserManagerFor(browser).then((browserManager) { | 268 return _browserManagerFor(browser).then((browserManager) { |
269 if (_closed) return null; | 269 if (_closed || browserManager == null) return null; |
270 return browserManager.loadSuite(path, suiteUrl, metadata); | 270 return browserManager.loadSuite(path, suiteUrl, metadata); |
271 }).then((suite) { | 271 }).then((suite) { |
272 if (_closed) return null; | 272 if (_closed) return null; |
273 if (suite != null) return suite.change(platform: browser.name); | 273 if (suite != null) return suite.change(platform: browser.name); |
274 | 274 |
275 // If the browser manager fails to load a suite and the server isn't | 275 // If the browser manager fails to load a suite and the server isn't |
276 // closed, it's probably because the browser failed. We emit the failure | 276 // closed, it's probably because the browser failed. We emit the failure |
277 // here to ensure that it gets surfaced. | 277 // here to ensure that it gets surfaced. |
278 return _browsers[browser].onExit; | 278 return _browsers[browser].onExit; |
279 }); | 279 }); |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 if (_pubServeUrl == null) { | 413 if (_pubServeUrl == null) { |
414 new Directory(_compiledDir).deleteSync(recursive: true); | 414 new Directory(_compiledDir).deleteSync(recursive: true); |
415 } else { | 415 } else { |
416 _http.close(); | 416 _http.close(); |
417 } | 417 } |
418 | 418 |
419 _closeCompleter.complete(); | 419 _closeCompleter.complete(); |
420 }).catchError(_closeCompleter.completeError); | 420 }).catchError(_closeCompleter.completeError); |
421 } | 421 } |
422 } | 422 } |
OLD | NEW |