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

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

Issue 1080903003: Detect an expired content shell and emit a nice error. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes 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 | « lib/src/runner/browser/content_shell.dart ('k') | no next file » | 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 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 return url.resolveUri( 243 return url.resolveUri(
244 p.toUri(p.relative(path, from: _root) + ".browser_test.html")); 244 p.toUri(p.relative(path, from: _root) + ".browser_test.html"));
245 }); 245 });
246 }).then((suiteUrl) { 246 }).then((suiteUrl) {
247 if (_closed) return null; 247 if (_closed) return null;
248 248
249 // TODO(nweiz): Don't start the browser until all the suites are compiled. 249 // TODO(nweiz): Don't start the browser until all the suites are compiled.
250 return _browserManagerFor(browser).then((browserManager) { 250 return _browserManagerFor(browser).then((browserManager) {
251 if (_closed) return null; 251 if (_closed) return null;
252 return browserManager.loadSuite(path, suiteUrl); 252 return browserManager.loadSuite(path, suiteUrl);
253 }).then((suite) => suite.change(platform: browser.name)); 253 }).then((suite) {
254 if (_closed) return null;
255 if (suite != null) return suite.change(platform: browser.name);
256
257 // If the browser manager fails to load a suite and the server isn't
258 // closed, it's probably because the browser failed. We emit the failure
259 // here to ensure that it gets surfaced.
260 return _browsers[browser].onExit;
261 });
254 }); 262 });
255 } 263 }
256 264
257 /// Loads a test suite at [path] from the `pub serve` URL [jsUrl]. 265 /// Loads a test suite at [path] from the `pub serve` URL [jsUrl].
258 /// 266 ///
259 /// This ensures that only one suite is loaded at a time, and that any errors 267 /// This ensures that only one suite is loaded at a time, and that any errors
260 /// are exposed as [LoadException]s. 268 /// are exposed as [LoadException]s.
261 Future _pubServeSuite(String path, Uri jsUrl) { 269 Future _pubServeSuite(String path, Uri jsUrl) {
262 return _pubServePool.withResource(() { 270 return _pubServePool.withResource(() {
263 var timer = new Timer(new Duration(seconds: 1), () { 271 var timer = new Timer(new Duration(seconds: 1), () {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 if (_pubServeUrl == null) { 388 if (_pubServeUrl == null) {
381 new Directory(_compiledDir).deleteSync(recursive: true); 389 new Directory(_compiledDir).deleteSync(recursive: true);
382 } else { 390 } else {
383 _http.close(); 391 _http.close();
384 } 392 }
385 393
386 _closeCompleter.complete(); 394 _closeCompleter.complete();
387 }).catchError(_closeCompleter.completeError); 395 }).catchError(_closeCompleter.completeError);
388 } 396 }
389 } 397 }
OLDNEW
« no previous file with comments | « lib/src/runner/browser/content_shell.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698