OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 shelf_web_socket.web_socket_test; | |
6 | |
7 import 'dart:io'; | 5 import 'dart:io'; |
8 | 6 |
9 import 'package:http/http.dart' as http; | 7 import 'package:http/http.dart' as http; |
10 import 'package:shelf/shelf_io.dart' as shelf_io; | 8 import 'package:shelf/shelf_io.dart' as shelf_io; |
11 import 'package:shelf_web_socket/shelf_web_socket.dart'; | 9 import 'package:shelf_web_socket/shelf_web_socket.dart'; |
12 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
13 | 11 |
14 Map<String, String> get _handshakeHeaders => { | 12 Map<String, String> get _handshakeHeaders => { |
15 "Upgrade": "websocket", | 13 "Upgrade": "websocket", |
16 "Connection": "Upgrade", | 14 "Connection": "Upgrade", |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 expect(() => webSocketHandler((_) => null, protocols: ['foo']), | 170 expect(() => webSocketHandler((_) => null, protocols: ['foo']), |
173 throwsArgumentError); | 171 throwsArgumentError); |
174 }); | 172 }); |
175 } | 173 } |
176 | 174 |
177 Matcher hasStatus(int status) => completion(predicate((response) { | 175 Matcher hasStatus(int status) => completion(predicate((response) { |
178 expect(response, new isInstanceOf<http.Response>()); | 176 expect(response, new isInstanceOf<http.Response>()); |
179 expect(response.statusCode, equals(status)); | 177 expect(response.statusCode, equals(status)); |
180 return true; | 178 return true; |
181 })); | 179 })); |
OLD | NEW |