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 && mac-os") | 5 @TestOn("vm && mac-os") |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
10 import 'package:test/src/runner/browser/safari.dart'; | 10 import 'package:test/src/runner/browser/safari.dart'; |
11 import 'package:test/src/util/io.dart'; | 11 import 'package:test/src/util/io.dart'; |
12 import 'package:shelf/shelf.dart' as shelf; | 12 import 'package:shelf/shelf.dart' as shelf; |
13 import 'package:shelf/shelf_io.dart' as shelf_io; | 13 import 'package:shelf/shelf_io.dart' as shelf_io; |
14 import 'package:shelf_web_socket/shelf_web_socket.dart'; | 14 import 'package:shelf_web_socket/shelf_web_socket.dart'; |
15 | 15 |
| 16 import '../../io.dart'; |
16 import '../../utils.dart'; | 17 import '../../utils.dart'; |
17 | 18 |
18 void main() { | 19 void main() { |
19 group("running JavaScript", () { | 20 group("running JavaScript", () { |
20 // The JavaScript to serve in the server. We use actual JavaScript here to | 21 // The JavaScript to serve in the server. We use actual JavaScript here to |
21 // avoid the pain of compiling to JS in a test | 22 // avoid the pain of compiling to JS in a test |
22 var javaScript; | 23 var javaScript; |
23 | 24 |
24 var servePage = (request) { | 25 var servePage = (request) { |
25 var path = request.url.path; | 26 var path = request.url.path; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 .then((server) { | 131 .then((server) { |
131 var safari = new Safari(baseUrlForAddress(server.address, server.port)); | 132 var safari = new Safari(baseUrlForAddress(server.address, server.port)); |
132 return safari.close().whenComplete(server.close); | 133 return safari.close().whenComplete(server.close); |
133 }); | 134 }); |
134 }); | 135 }); |
135 | 136 |
136 test("reports an error in onExit", () { | 137 test("reports an error in onExit", () { |
137 var safari = new Safari("http://dart-lang.org", | 138 var safari = new Safari("http://dart-lang.org", |
138 executable: "_does_not_exist"); | 139 executable: "_does_not_exist"); |
139 expect(safari.onExit, throwsA(isApplicationException(startsWith( | 140 expect(safari.onExit, throwsA(isApplicationException(startsWith( |
140 "Failed to start Safari: No such file or directory")))); | 141 "Failed to start Safari: $noSuchFileMessage")))); |
141 }); | 142 }); |
142 } | 143 } |
OLD | NEW |