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_handshake_stream_create_helper.h" | 5 #include "net/websockets/websocket_handshake_stream_create_helper.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 const std::string& extra_request_headers, | 78 const std::string& extra_request_headers, |
79 const std::string& extra_response_headers) { | 79 const std::string& extra_response_headers) { |
80 static const char kOrigin[] = "http://localhost"; | 80 static const char kOrigin[] = "http://localhost"; |
81 WebSocketHandshakeStreamCreateHelper create_helper(&connect_delegate_, | 81 WebSocketHandshakeStreamCreateHelper create_helper(&connect_delegate_, |
82 sub_protocols); | 82 sub_protocols); |
83 create_helper.set_failure_message(&failure_message_); | 83 create_helper.set_failure_message(&failure_message_); |
84 | 84 |
85 std::unique_ptr<ClientSocketHandle> socket_handle = | 85 std::unique_ptr<ClientSocketHandle> socket_handle = |
86 socket_handle_factory_.CreateClientSocketHandle( | 86 socket_handle_factory_.CreateClientSocketHandle( |
87 WebSocketStandardRequest("/", "localhost", | 87 WebSocketStandardRequest("/", "localhost", |
88 url::Origin(GURL(kOrigin)), | 88 url::Origin(GURL(kOrigin)), "", |
89 extra_request_headers), | 89 extra_request_headers), |
90 WebSocketStandardResponse(extra_response_headers)); | 90 WebSocketStandardResponse(extra_response_headers)); |
91 | 91 |
92 std::unique_ptr<WebSocketHandshakeStreamBase> handshake( | 92 std::unique_ptr<WebSocketHandshakeStreamBase> handshake( |
93 create_helper.CreateBasicStream(std::move(socket_handle), false)); | 93 create_helper.CreateBasicStream(std::move(socket_handle), false)); |
94 | 94 |
95 // If in future the implementation type returned by CreateBasicStream() | 95 // If in future the implementation type returned by CreateBasicStream() |
96 // changes, this static_cast will be wrong. However, in that case the test | 96 // changes, this static_cast will be wrong. However, in that case the test |
97 // will fail and AddressSanitizer should identify the issue. | 97 // will fail and AddressSanitizer should identify the issue. |
98 static_cast<WebSocketBasicHandshakeStream*>(handshake.get()) | 98 static_cast<WebSocketBasicHandshakeStream*>(handshake.get()) |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 | 177 |
178 EXPECT_EQ( | 178 EXPECT_EQ( |
179 "permessage-deflate;" | 179 "permessage-deflate;" |
180 " client_max_window_bits=14; server_max_window_bits=14;" | 180 " client_max_window_bits=14; server_max_window_bits=14;" |
181 " server_no_context_takeover; client_no_context_takeover", | 181 " server_no_context_takeover; client_no_context_takeover", |
182 stream->GetExtensions()); | 182 stream->GetExtensions()); |
183 } | 183 } |
184 | 184 |
185 } // namespace | 185 } // namespace |
186 } // namespace net | 186 } // namespace net |
OLD | NEW |