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 test.channel.web_socket; | 5 library test.channel.web_socket; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 9 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
10 import 'package:analysis_server/src/channel/web_socket_channel.dart'; | 10 import 'package:analysis_server/src/channel/web_socket_channel.dart'; |
11 import 'package:analyzer/instrumentation/instrumentation.dart'; | 11 import 'package:analyzer/instrumentation/instrumentation.dart'; |
12 import 'package:test/test.dart'; | 12 import 'package:test/test.dart'; |
13 | 13 |
14 import '../mocks.dart'; | 14 import '../mocks.dart'; |
15 import '../utils.dart'; | |
16 | 15 |
17 main() { | 16 main() { |
18 initializeTestEnvironment(); | |
19 group('WebSocketChannel', () { | 17 group('WebSocketChannel', () { |
20 setUp(WebSocketChannelTest.setUp); | 18 setUp(WebSocketChannelTest.setUp); |
21 test('close', WebSocketChannelTest.close); | 19 test('close', WebSocketChannelTest.close); |
22 test('invalidJsonToClient', WebSocketChannelTest.invalidJsonToClient); | 20 test('invalidJsonToClient', WebSocketChannelTest.invalidJsonToClient); |
23 test('invalidJsonToServer', WebSocketChannelTest.invalidJsonToServer); | 21 test('invalidJsonToServer', WebSocketChannelTest.invalidJsonToServer); |
24 test('notification', WebSocketChannelTest.notification); | 22 test('notification', WebSocketChannelTest.notification); |
25 test('notificationAndResponse', | 23 test('notificationAndResponse', |
26 WebSocketChannelTest.notificationAndResponse); | 24 WebSocketChannelTest.notificationAndResponse); |
27 test('request', WebSocketChannelTest.request); | 25 test('request', WebSocketChannelTest.request); |
28 test('requestResponse', WebSocketChannelTest.requestResponse); | 26 test('requestResponse', WebSocketChannelTest.requestResponse); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 notificationsReceived = <Notification>[]; | 147 notificationsReceived = <Notification>[]; |
150 | 148 |
151 // Allow multiple listeners on server side for testing. | 149 // Allow multiple listeners on server side for testing. |
152 socket.twin.allowMultipleListeners(); | 150 socket.twin.allowMultipleListeners(); |
153 | 151 |
154 server.listen(requestsReceived.add); | 152 server.listen(requestsReceived.add); |
155 client.responseStream.listen(responsesReceived.add); | 153 client.responseStream.listen(responsesReceived.add); |
156 client.notificationStream.listen(notificationsReceived.add); | 154 client.notificationStream.listen(notificationsReceived.add); |
157 } | 155 } |
158 } | 156 } |
OLD | NEW |