| 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 @TestOn("vm") | 5 @TestOn("vm") |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:shelf/shelf.dart' as shelf; | 10 import 'package:shelf/shelf.dart' as shelf; |
| 11 import 'package:shelf/shelf_io.dart' as shelf_io; | 11 import 'package:shelf/shelf_io.dart' as shelf_io; |
| 12 import 'package:shelf_web_socket/shelf_web_socket.dart'; | 12 import 'package:shelf_web_socket/shelf_web_socket.dart'; |
| 13 import 'package:test/src/runner/browser/dartium.dart'; | 13 import 'package:test/src/runner/browser/dartium.dart'; |
| 14 import 'package:test/src/util/io.dart'; | 14 import 'package:test/src/util/io.dart'; |
| 15 import 'package:test/src/utils.dart'; | 15 import 'package:test/src/utils.dart'; |
| 16 import 'package:test/test.dart'; | 16 import 'package:test/test.dart'; |
| 17 | 17 |
| 18 import '../../utils.dart'; |
| 19 |
| 18 void main() { | 20 void main() { |
| 19 group("running Dart", () { | 21 group("running Dart", () { |
| 20 // The Dart to serve in the server. | 22 // The Dart to serve in the server. |
| 21 var dart; | 23 var dart; |
| 22 | 24 |
| 23 var servePage = (request) { | 25 var servePage = (request) { |
| 24 var path = shelfUrl(request).path; | 26 var path = shelfUrl(request).path; |
| 25 | 27 |
| 26 if (path.isEmpty) { | 28 if (path.isEmpty) { |
| 27 return new shelf.Response.ok(""" | 29 return new shelf.Response.ok(""" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 return shelf_io.serve(expectAsync((_) {}, count: 0), 'localhost', 0) | 130 return shelf_io.serve(expectAsync((_) {}, count: 0), 'localhost', 0) |
| 129 .then((server) { | 131 .then((server) { |
| 130 var dartium = new Dartium(baseUrlForAddress(server.address, server.port)); | 132 var dartium = new Dartium(baseUrlForAddress(server.address, server.port)); |
| 131 return dartium.close().whenComplete(server.close); | 133 return dartium.close().whenComplete(server.close); |
| 132 }); | 134 }); |
| 133 }); | 135 }); |
| 134 | 136 |
| 135 test("reports an error in onExit", () { | 137 test("reports an error in onExit", () { |
| 136 var dartium = new Dartium("http://dart-lang.org", | 138 var dartium = new Dartium("http://dart-lang.org", |
| 137 executable: "_does_not_exist"); | 139 executable: "_does_not_exist"); |
| 138 expect(dartium.onExit, throwsA(new isInstanceOf<ProcessException>())); | 140 expect(dartium.onExit, throwsA(isApplicationException(startsWith( |
| 141 "Failed to start Dartium: No such file or directory")))); |
| 139 }); | 142 }); |
| 140 } | 143 } |
| OLD | NEW |