| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // CreateBasicStream() changes. | 70 // CreateBasicStream() changes. |
| 71 static_cast<WebSocketBasicHandshakeStream*>(stream()) | 71 static_cast<WebSocketBasicHandshakeStream*>(stream()) |
| 72 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); | 72 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); |
| 73 return stream(); | 73 return stream(); |
| 74 } | 74 } |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 class WebSocketStreamCreateTest : public ::testing::Test { | 77 class WebSocketStreamCreateTest : public ::testing::Test { |
| 78 protected: | 78 protected: |
| 79 WebSocketStreamCreateTest(): has_failed_(false) {} | 79 WebSocketStreamCreateTest(): has_failed_(false) {} |
| 80 virtual ~WebSocketStreamCreateTest() { |
| 81 url_request_context_host_.GetURLRequestContext() |
| 82 ->http_transaction_factory() |
| 83 ->GetCache() |
| 84 ->CloseAllConnections(); |
| 85 } |
| 80 | 86 |
| 81 void CreateAndConnectCustomResponse( | 87 void CreateAndConnectCustomResponse( |
| 82 const std::string& socket_url, | 88 const std::string& socket_url, |
| 83 const std::string& socket_path, | 89 const std::string& socket_path, |
| 84 const std::vector<std::string>& sub_protocols, | 90 const std::vector<std::string>& sub_protocols, |
| 85 const std::string& origin, | 91 const std::string& origin, |
| 86 const std::string& extra_request_headers, | 92 const std::string& extra_request_headers, |
| 87 const std::string& response_body) { | 93 const std::string& response_body) { |
| 88 url_request_context_host_.SetExpectations( | 94 url_request_context_host_.SetExpectations( |
| 89 WebSocketStandardRequest(socket_path, origin, extra_request_headers), | 95 WebSocketStandardRequest(socket_path, origin, extra_request_headers), |
| (...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1002 socket_data->RunFor(2); | 1008 socket_data->RunFor(2); |
| 1003 EXPECT_TRUE(has_failed()); | 1009 EXPECT_TRUE(has_failed()); |
| 1004 EXPECT_FALSE(stream_); | 1010 EXPECT_FALSE(stream_); |
| 1005 EXPECT_FALSE(response_info_); | 1011 EXPECT_FALSE(response_info_); |
| 1006 EXPECT_EQ("Connection closed before receiving a handshake response", | 1012 EXPECT_EQ("Connection closed before receiving a handshake response", |
| 1007 failure_message()); | 1013 failure_message()); |
| 1008 } | 1014 } |
| 1009 | 1015 |
| 1010 } // namespace | 1016 } // namespace |
| 1011 } // namespace net | 1017 } // namespace net |
| OLD | NEW |