| 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; | 5 library shelf_web_socket.web_socket_test; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
| 10 import 'package:shelf/shelf_io.dart' as shelf_io; | 10 import 'package:shelf/shelf_io.dart' as shelf_io; |
| 11 import 'package:shelf_web_socket/shelf_web_socket.dart'; | 11 import 'package:shelf_web_socket/shelf_web_socket.dart'; |
| 12 import 'package:unittest/unittest.dart'; | 12 import 'package:test/test.dart'; |
| 13 | 13 |
| 14 Map<String, String> get _handshakeHeaders => { | 14 Map<String, String> get _handshakeHeaders => { |
| 15 "Upgrade": "websocket", | 15 "Upgrade": "websocket", |
| 16 "Connection": "Upgrade", | 16 "Connection": "Upgrade", |
| 17 "Sec-WebSocket-Key": "x3JJHMbDL1EzLkh9GBhXDw==", | 17 "Sec-WebSocket-Key": "x3JJHMbDL1EzLkh9GBhXDw==", |
| 18 "Sec-WebSocket-Version": "13" | 18 "Sec-WebSocket-Version": "13" |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 void main() { | 21 void main() { |
| 22 test("can communicate with a dart:io WebSocket client", () { | 22 test("can communicate with a dart:io WebSocket client", () { |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 expect(() => webSocketHandler((_) => null, protocols: ['foo']), | 172 expect(() => webSocketHandler((_) => null, protocols: ['foo']), |
| 173 throwsArgumentError); | 173 throwsArgumentError); |
| 174 }); | 174 }); |
| 175 } | 175 } |
| 176 | 176 |
| 177 Matcher hasStatus(int status) => completion(predicate((response) { | 177 Matcher hasStatus(int status) => completion(predicate((response) { |
| 178 expect(response, new isInstanceOf<http.Response>()); | 178 expect(response, new isInstanceOf<http.Response>()); |
| 179 expect(response.statusCode, equals(status)); | 179 expect(response.statusCode, equals(status)); |
| 180 return true; | 180 return true; |
| 181 })); | 181 })); |
| OLD | NEW |