| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/websockets/websocket_stream.h" | 5 #include "net/websockets/websocket_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n" | 696 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n" |
| 697 "\r\n"; | 697 "\r\n"; |
| 698 CreateAndConnectCustomResponse("ws://localhost/", | 698 CreateAndConnectCustomResponse("ws://localhost/", |
| 699 "/", | 699 "/", |
| 700 NoSubProtocols(), | 700 NoSubProtocols(), |
| 701 "http://localhost/", | 701 "http://localhost/", |
| 702 "", | 702 "", |
| 703 kMalformedResponse); | 703 kMalformedResponse); |
| 704 RunUntilIdle(); | 704 RunUntilIdle(); |
| 705 EXPECT_TRUE(has_failed()); | 705 EXPECT_TRUE(has_failed()); |
| 706 EXPECT_EQ("Error during WebSocket handshake: Unexpected response code: 200", | 706 EXPECT_EQ("Error during WebSocket handshake: Invalid status line", |
| 707 failure_message()); | 707 failure_message()); |
| 708 } | 708 } |
| 709 | 709 |
| 710 // Upgrade header must be present. | 710 // Upgrade header must be present. |
| 711 TEST_F(WebSocketStreamCreateTest, MissingUpgradeHeader) { | 711 TEST_F(WebSocketStreamCreateTest, MissingUpgradeHeader) { |
| 712 static const char kMissingUpgradeResponse[] = | 712 static const char kMissingUpgradeResponse[] = |
| 713 "HTTP/1.1 101 Switching Protocols\r\n" | 713 "HTTP/1.1 101 Switching Protocols\r\n" |
| 714 "Connection: Upgrade\r\n" | 714 "Connection: Upgrade\r\n" |
| 715 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n" | 715 "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n" |
| 716 "\r\n"; | 716 "\r\n"; |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 socket_data->RunFor(2); | 1001 socket_data->RunFor(2); |
| 1002 EXPECT_TRUE(has_failed()); | 1002 EXPECT_TRUE(has_failed()); |
| 1003 EXPECT_FALSE(stream_); | 1003 EXPECT_FALSE(stream_); |
| 1004 EXPECT_FALSE(response_info_); | 1004 EXPECT_FALSE(response_info_); |
| 1005 EXPECT_EQ("Connection closed before receiving a handshake response", | 1005 EXPECT_EQ("Connection closed before receiving a handshake response", |
| 1006 failure_message()); | 1006 failure_message()); |
| 1007 } | 1007 } |
| 1008 | 1008 |
| 1009 } // namespace | 1009 } // namespace |
| 1010 } // namespace net | 1010 } // namespace net |
| OLD | NEW |