[email protected] | ce9f7ffd | 2013-10-11 06:04:11 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "net/websockets/websocket_test_util.h" |
| 6 | |
tfarina | ea94afc23 | 2015-10-20 04:23:36 | [diff] [blame] | 7 | #include <stddef.h> |
[email protected] | 9483152 | 2014-02-06 12:05:18 | [diff] [blame] | 8 | #include <algorithm> |
dcheng | c7eeda42 | 2015-12-26 03:56:48 | [diff] [blame] | 9 | #include <utility> |
[email protected] | 9483152 | 2014-02-06 12:05:18 | [diff] [blame] | 10 | |
Bence Béky | 3a0c4853 | 2018-03-02 13:38:51 | [diff] [blame] | 11 | #include "base/strings/strcat.h" |
Bence Béky | 46bfbc1 | 2018-02-22 19:28:20 | [diff] [blame] | 12 | #include "base/strings/string_util.h" |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 13 | #include "base/strings/stringprintf.h" |
Bence Béky | 70dd766 | 2018-03-02 17:13:24 | [diff] [blame] | 14 | #include "net/http/http_network_session.h" |
Lily Houghton | ffe89daa0 | 2018-03-09 18:30:03 | [diff] [blame] | 15 | #include "net/proxy_resolution/proxy_resolution_service.h" |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 16 | #include "net/socket/socket_test_util.h" |
Victor Vasiliev | 27cc771 | 2019-01-24 11:50:14 | [diff] [blame] | 17 | #include "net/third_party/quiche/src/spdy/core/spdy_protocol.h" |
Ramin Halavati | ca8d525 | 2018-03-12 05:33:49 | [diff] [blame] | 18 | #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" |
Bence Béky | 8d1c605 | 2018-02-07 12:48:15 | [diff] [blame] | 19 | #include "net/websockets/websocket_basic_handshake_stream.h" |
mkwst | 4997ce8 | 2015-07-25 12:00:05 | [diff] [blame] | 20 | #include "url/origin.h" |
[email protected] | ce9f7ffd | 2013-10-11 06:04:11 | [diff] [blame] | 21 | |
| 22 | namespace net { |
| 23 | |
| 24 | namespace { |
tfarina | ea94afc23 | 2015-10-20 04:23:36 | [diff] [blame] | 25 | |
tfarina | 8a2c66c2 | 2015-10-13 19:14:49 | [diff] [blame] | 26 | const uint64_t kA = (static_cast<uint64_t>(0x5851f42d) << 32) + |
| 27 | static_cast<uint64_t>(0x4c957f2d); |
| 28 | const uint64_t kC = 12345; |
| 29 | const uint64_t kM = static_cast<uint64_t>(1) << 48; |
[email protected] | ce9f7ffd | 2013-10-11 06:04:11 | [diff] [blame] | 30 | |
| 31 | } // namespace |
| 32 | |
tfarina | 8a2c66c2 | 2015-10-13 19:14:49 | [diff] [blame] | 33 | LinearCongruentialGenerator::LinearCongruentialGenerator(uint32_t seed) |
[email protected] | ce9f7ffd | 2013-10-11 06:04:11 | [diff] [blame] | 34 | : current_(seed) {} |
| 35 | |
tfarina | 8a2c66c2 | 2015-10-13 19:14:49 | [diff] [blame] | 36 | uint32_t LinearCongruentialGenerator::Generate() { |
| 37 | uint64_t result = current_; |
[email protected] | ce9f7ffd | 2013-10-11 06:04:11 | [diff] [blame] | 38 | current_ = (current_ * kA + kC) % kM; |
tfarina | 8a2c66c2 | 2015-10-13 19:14:49 | [diff] [blame] | 39 | return static_cast<uint32_t>(result >> 16); |
[email protected] | ce9f7ffd | 2013-10-11 06:04:11 | [diff] [blame] | 40 | } |
| 41 | |
Bence Béky | 3a0c4853 | 2018-03-02 13:38:51 | [diff] [blame] | 42 | std::string WebSocketExtraHeadersToString( |
| 43 | const WebSocketExtraHeaders& headers) { |
| 44 | std::string answer; |
| 45 | for (const auto& header : headers) { |
| 46 | base::StrAppend(&answer, {header.first, ": ", header.second, "\r\n"}); |
| 47 | } |
| 48 | return answer; |
| 49 | } |
| 50 | |
Yutaka Hirano | 2f65eec | 2018-05-23 01:58:22 | [diff] [blame] | 51 | HttpRequestHeaders WebSocketExtraHeadersToHttpRequestHeaders( |
| 52 | const WebSocketExtraHeaders& headers) { |
| 53 | HttpRequestHeaders headers_to_return; |
| 54 | for (const auto& header : headers) |
| 55 | headers_to_return.SetHeader(header.first, header.second); |
| 56 | return headers_to_return; |
| 57 | } |
| 58 | |
allada | cef397d | 2016-06-29 17:52:23 | [diff] [blame] | 59 | std::string WebSocketStandardRequest( |
| 60 | const std::string& path, |
| 61 | const std::string& host, |
| 62 | const url::Origin& origin, |
| 63 | const std::string& send_additional_request_headers, |
| 64 | const std::string& extra_headers) { |
yhirano | 01a5d66 | 2015-02-12 04:33:06 | [diff] [blame] | 65 | return WebSocketStandardRequestWithCookies(path, host, origin, std::string(), |
allada | cef397d | 2016-06-29 17:52:23 | [diff] [blame] | 66 | send_additional_request_headers, |
yhirano | 01a5d66 | 2015-02-12 04:33:06 | [diff] [blame] | 67 | extra_headers); |
| 68 | } |
| 69 | |
| 70 | std::string WebSocketStandardRequestWithCookies( |
| 71 | const std::string& path, |
| 72 | const std::string& host, |
mkwst | 4997ce8 | 2015-07-25 12:00:05 | [diff] [blame] | 73 | const url::Origin& origin, |
yhirano | 01a5d66 | 2015-02-12 04:33:06 | [diff] [blame] | 74 | const std::string& cookies, |
allada | cef397d | 2016-06-29 17:52:23 | [diff] [blame] | 75 | const std::string& send_additional_request_headers, |
yhirano | 01a5d66 | 2015-02-12 04:33:06 | [diff] [blame] | 76 | const std::string& extra_headers) { |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 77 | // Unrelated changes in net/http may change the order and default-values of |
| 78 | // HTTP headers, causing WebSocket tests to fail. It is safe to update this |
allada | cef397d | 2016-06-29 17:52:23 | [diff] [blame] | 79 | // in that case. |
| 80 | HttpRequestHeaders headers; |
| 81 | std::stringstream request_headers; |
| 82 | |
| 83 | request_headers << base::StringPrintf("GET %s HTTP/1.1\r\n", path.c_str()); |
| 84 | headers.SetHeader("Host", host); |
| 85 | headers.SetHeader("Connection", "Upgrade"); |
| 86 | headers.SetHeader("Pragma", "no-cache"); |
| 87 | headers.SetHeader("Cache-Control", "no-cache"); |
Yutaka Hirano | 2f65eec | 2018-05-23 01:58:22 | [diff] [blame] | 88 | headers.AddHeadersFromString(send_additional_request_headers); |
allada | cef397d | 2016-06-29 17:52:23 | [diff] [blame] | 89 | headers.SetHeader("Upgrade", "websocket"); |
| 90 | headers.SetHeader("Origin", origin.Serialize()); |
| 91 | headers.SetHeader("Sec-WebSocket-Version", "13"); |
Yutaka Hirano | 2f65eec | 2018-05-23 01:58:22 | [diff] [blame] | 92 | if (!headers.HasHeader("User-Agent")) |
| 93 | headers.SetHeader("User-Agent", ""); |
allada | cef397d | 2016-06-29 17:52:23 | [diff] [blame] | 94 | headers.SetHeader("Accept-Encoding", "gzip, deflate"); |
| 95 | headers.SetHeader("Accept-Language", "en-us,fr"); |
| 96 | headers.AddHeadersFromString(cookies); |
| 97 | headers.SetHeader("Sec-WebSocket-Key", "dGhlIHNhbXBsZSBub25jZQ=="); |
| 98 | headers.SetHeader("Sec-WebSocket-Extensions", |
| 99 | "permessage-deflate; client_max_window_bits"); |
| 100 | headers.AddHeadersFromString(extra_headers); |
| 101 | |
| 102 | request_headers << headers.ToString(); |
| 103 | return request_headers.str(); |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 104 | } |
| 105 | |
| 106 | std::string WebSocketStandardResponse(const std::string& extra_headers) { |
| 107 | return base::StringPrintf( |
| 108 | "HTTP/1.1 101 Switching Protocols\r\n" |
| 109 | "Upgrade: websocket\r\n" |
| 110 | "Connection: Upgrade\r\n" |
| 111 | "Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r\n" |
| 112 | "%s\r\n", |
| 113 | extra_headers.c_str()); |
| 114 | } |
| 115 | |
Adam Rice | d4596a8e | 2018-07-13 08:06:17 | [diff] [blame] | 116 | HttpRequestHeaders WebSocketCommonTestHeaders() { |
| 117 | HttpRequestHeaders request_headers; |
| 118 | request_headers.SetHeader("Host", "www.example.org"); |
| 119 | request_headers.SetHeader("Connection", "Upgrade"); |
| 120 | request_headers.SetHeader("Pragma", "no-cache"); |
| 121 | request_headers.SetHeader("Cache-Control", "no-cache"); |
| 122 | request_headers.SetHeader("Upgrade", "websocket"); |
| 123 | request_headers.SetHeader("Origin", "http://origin.example.org"); |
| 124 | request_headers.SetHeader("Sec-WebSocket-Version", "13"); |
| 125 | request_headers.SetHeader("User-Agent", ""); |
| 126 | request_headers.SetHeader("Accept-Encoding", "gzip, deflate"); |
| 127 | request_headers.SetHeader("Accept-Language", "en-us,fr"); |
| 128 | return request_headers; |
| 129 | } |
| 130 | |
Ryan Hamilton | 0239aac | 2018-05-19 00:03:13 | [diff] [blame] | 131 | spdy::SpdyHeaderBlock WebSocketHttp2Request( |
Bence Béky | 46bfbc1 | 2018-02-22 19:28:20 | [diff] [blame] | 132 | const std::string& path, |
| 133 | const std::string& authority, |
| 134 | const std::string& origin, |
| 135 | const WebSocketExtraHeaders& extra_headers) { |
Ryan Hamilton | 0239aac | 2018-05-19 00:03:13 | [diff] [blame] | 136 | spdy::SpdyHeaderBlock request_headers; |
| 137 | request_headers[spdy::kHttp2MethodHeader] = "CONNECT"; |
| 138 | request_headers[spdy::kHttp2AuthorityHeader] = authority; |
| 139 | request_headers[spdy::kHttp2SchemeHeader] = "https"; |
| 140 | request_headers[spdy::kHttp2PathHeader] = path; |
| 141 | request_headers[spdy::kHttp2ProtocolHeader] = "websocket"; |
Bence Béky | 46bfbc1 | 2018-02-22 19:28:20 | [diff] [blame] | 142 | request_headers["pragma"] = "no-cache"; |
| 143 | request_headers["cache-control"] = "no-cache"; |
| 144 | request_headers["origin"] = origin; |
| 145 | request_headers["sec-websocket-version"] = "13"; |
| 146 | request_headers["user-agent"] = ""; |
| 147 | request_headers["accept-encoding"] = "gzip, deflate"; |
| 148 | request_headers["accept-language"] = "en-us,fr"; |
| 149 | request_headers["sec-websocket-extensions"] = |
| 150 | "permessage-deflate; client_max_window_bits"; |
| 151 | for (const auto& header : extra_headers) { |
| 152 | request_headers[base::ToLowerASCII(header.first)] = header.second; |
| 153 | } |
| 154 | return request_headers; |
| 155 | } |
| 156 | |
Ryan Hamilton | 0239aac | 2018-05-19 00:03:13 | [diff] [blame] | 157 | spdy::SpdyHeaderBlock WebSocketHttp2Response( |
Bence Béky | 46bfbc1 | 2018-02-22 19:28:20 | [diff] [blame] | 158 | const WebSocketExtraHeaders& extra_headers) { |
Ryan Hamilton | 0239aac | 2018-05-19 00:03:13 | [diff] [blame] | 159 | spdy::SpdyHeaderBlock response_headers; |
| 160 | response_headers[spdy::kHttp2StatusHeader] = "200"; |
Bence Béky | 46bfbc1 | 2018-02-22 19:28:20 | [diff] [blame] | 161 | for (const auto& header : extra_headers) { |
| 162 | response_headers[base::ToLowerASCII(header.first)] = header.second; |
| 163 | } |
| 164 | return response_headers; |
| 165 | } |
| 166 | |
mmenke | d0d201a | 2015-06-08 12:00:12 | [diff] [blame] | 167 | struct WebSocketMockClientSocketFactoryMaker::Detail { |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 168 | std::string expect_written; |
| 169 | std::string return_to_read; |
[email protected] | 9483152 | 2014-02-06 12:05:18 | [diff] [blame] | 170 | std::vector<MockRead> reads; |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 171 | MockWrite write; |
danakj | 9c5cab5 | 2016-04-16 00:54:33 | [diff] [blame] | 172 | std::vector<std::unique_ptr<SequencedSocketData>> socket_data_vector; |
| 173 | std::vector<std::unique_ptr<SSLSocketDataProvider>> ssl_socket_data_vector; |
mmenke | d0d201a | 2015-06-08 12:00:12 | [diff] [blame] | 174 | MockClientSocketFactory factory; |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 175 | }; |
| 176 | |
mmenke | d0d201a | 2015-06-08 12:00:12 | [diff] [blame] | 177 | WebSocketMockClientSocketFactoryMaker::WebSocketMockClientSocketFactoryMaker() |
Bence Béky | 6562397 | 2018-03-05 15:31:56 | [diff] [blame] | 178 | : detail_(std::make_unique<Detail>()) {} |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 179 | |
mmenke | d0d201a | 2015-06-08 12:00:12 | [diff] [blame] | 180 | WebSocketMockClientSocketFactoryMaker:: |
Chris Watkins | 28c2fdd | 2017-11-30 06:06:52 | [diff] [blame] | 181 | ~WebSocketMockClientSocketFactoryMaker() = default; |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 182 | |
mmenke | d0d201a | 2015-06-08 12:00:12 | [diff] [blame] | 183 | MockClientSocketFactory* WebSocketMockClientSocketFactoryMaker::factory() { |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 184 | return &detail_->factory; |
| 185 | } |
| 186 | |
mmenke | d0d201a | 2015-06-08 12:00:12 | [diff] [blame] | 187 | void WebSocketMockClientSocketFactoryMaker::SetExpectations( |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 188 | const std::string& expect_written, |
| 189 | const std::string& return_to_read) { |
[email protected] | 9483152 | 2014-02-06 12:05:18 | [diff] [blame] | 190 | const size_t kHttpStreamParserBufferSize = 4096; |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 191 | // We need to extend the lifetime of these strings. |
| 192 | detail_->expect_written = expect_written; |
| 193 | detail_->return_to_read = return_to_read; |
[email protected] | 9483152 | 2014-02-06 12:05:18 | [diff] [blame] | 194 | int sequence = 0; |
[email protected] | 0be9392 | 2014-01-29 00:42:45 | [diff] [blame] | 195 | detail_->write = MockWrite(SYNCHRONOUS, |
| 196 | detail_->expect_written.data(), |
| 197 | detail_->expect_written.size(), |
[email protected] | 9483152 | 2014-02-06 12:05:18 | [diff] [blame] | 198 | sequence++); |
| 199 | // HttpStreamParser reads 4KB at a time. We need to take this implementation |
| 200 | // detail into account if |return_to_read| is big enough. |
| 201 | for (size_t place = 0; place < detail_->return_to_read.size(); |
| 202 | place += kHttpStreamParserBufferSize) { |
| 203 | detail_->reads.push_back( |
| 204 | MockRead(SYNCHRONOUS, detail_->return_to_read.data() + place, |
| 205 | std::min(detail_->return_to_read.size() - place, |
| 206 | kHttpStreamParserBufferSize), |
| 207 | sequence++)); |
| 208 | } |
Bence Béky | 6562397 | 2018-03-05 15:31:56 | [diff] [blame] | 209 | auto socket_data = std::make_unique<SequencedSocketData>( |
Ryan Sleevi | b8d7ea0 | 2018-05-07 20:01:01 | [diff] [blame] | 210 | detail_->reads, base::make_span(&detail_->write, 1)); |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 211 | socket_data->set_connect_data(MockConnect(SYNCHRONOUS, OK)); |
dcheng | c7eeda42 | 2015-12-26 03:56:48 | [diff] [blame] | 212 | AddRawExpectations(std::move(socket_data)); |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 213 | } |
| 214 | |
mmenke | d0d201a | 2015-06-08 12:00:12 | [diff] [blame] | 215 | void WebSocketMockClientSocketFactoryMaker::AddRawExpectations( |
danakj | 9c5cab5 | 2016-04-16 00:54:33 | [diff] [blame] | 216 | std::unique_ptr<SequencedSocketData> socket_data) { |
[email protected] | a6244952 | 2014-06-05 11:11:15 | [diff] [blame] | 217 | detail_->factory.AddSocketDataProvider(socket_data.get()); |
dcheng | c7eeda42 | 2015-12-26 03:56:48 | [diff] [blame] | 218 | detail_->socket_data_vector.push_back(std::move(socket_data)); |
[email protected] | a6244952 | 2014-06-05 11:11:15 | [diff] [blame] | 219 | } |
| 220 | |
mmenke | d0d201a | 2015-06-08 12:00:12 | [diff] [blame] | 221 | void WebSocketMockClientSocketFactoryMaker::AddSSLSocketDataProvider( |
danakj | 9c5cab5 | 2016-04-16 00:54:33 | [diff] [blame] | 222 | std::unique_ptr<SSLSocketDataProvider> ssl_socket_data) { |
[email protected] | a6244952 | 2014-06-05 11:11:15 | [diff] [blame] | 223 | detail_->factory.AddSSLSocketDataProvider(ssl_socket_data.get()); |
dcheng | c7eeda42 | 2015-12-26 03:56:48 | [diff] [blame] | 224 | detail_->ssl_socket_data_vector.push_back(std::move(ssl_socket_data)); |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | WebSocketTestURLRequestContextHost::WebSocketTestURLRequestContextHost() |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 228 | : url_request_context_(true), url_request_context_initialized_(false) { |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 229 | url_request_context_.set_client_socket_factory(maker_.factory()); |
Bence Béky | 70dd766 | 2018-03-02 17:13:24 | [diff] [blame] | 230 | auto params = std::make_unique<HttpNetworkSession::Params>(); |
| 231 | params->enable_spdy_ping_based_connection_checking = false; |
| 232 | params->enable_quic = false; |
| 233 | params->enable_websocket_over_http2 = true; |
| 234 | params->disable_idle_sockets_close_on_memory_pressure = false; |
| 235 | url_request_context_.set_http_network_session_params(std::move(params)); |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 236 | } |
| 237 | |
Chris Watkins | 28c2fdd | 2017-11-30 06:06:52 | [diff] [blame] | 238 | WebSocketTestURLRequestContextHost::~WebSocketTestURLRequestContextHost() = |
| 239 | default; |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 240 | |
[email protected] | a6244952 | 2014-06-05 11:11:15 | [diff] [blame] | 241 | void WebSocketTestURLRequestContextHost::AddRawExpectations( |
danakj | 9c5cab5 | 2016-04-16 00:54:33 | [diff] [blame] | 242 | std::unique_ptr<SequencedSocketData> socket_data) { |
dcheng | c7eeda42 | 2015-12-26 03:56:48 | [diff] [blame] | 243 | maker_.AddRawExpectations(std::move(socket_data)); |
[email protected] | a6244952 | 2014-06-05 11:11:15 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | void WebSocketTestURLRequestContextHost::AddSSLSocketDataProvider( |
danakj | 9c5cab5 | 2016-04-16 00:54:33 | [diff] [blame] | 247 | std::unique_ptr<SSLSocketDataProvider> ssl_socket_data) { |
dcheng | c7eeda42 | 2015-12-26 03:56:48 | [diff] [blame] | 248 | maker_.AddSSLSocketDataProvider(std::move(ssl_socket_data)); |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 249 | } |
| 250 | |
ricea | 38fc268c | 2015-02-09 02:41:29 | [diff] [blame] | 251 | void WebSocketTestURLRequestContextHost::SetProxyConfig( |
| 252 | const std::string& proxy_rules) { |
| 253 | DCHECK(!url_request_context_initialized_); |
Ramin Halavati | ca8d525 | 2018-03-12 05:33:49 | [diff] [blame] | 254 | proxy_resolution_service_ = ProxyResolutionService::CreateFixed( |
| 255 | proxy_rules, TRAFFIC_ANNOTATION_FOR_TESTS); |
Lily Houghton | 8c2f97d | 2018-01-22 05:06:59 | [diff] [blame] | 256 | url_request_context_.set_proxy_resolution_service( |
| 257 | proxy_resolution_service_.get()); |
ricea | 38fc268c | 2015-02-09 02:41:29 | [diff] [blame] | 258 | } |
| 259 | |
Yutaka Hirano | 70fa2591 | 2018-06-06 05:26:54 | [diff] [blame] | 260 | int DummyConnectDelegate::OnAuthRequired( |
| 261 | scoped_refptr<AuthChallengeInfo> auth_info, |
| 262 | scoped_refptr<HttpResponseHeaders> response_headers, |
| 263 | const HostPortPair& host_port_pair, |
| 264 | base::OnceCallback<void(const AuthCredentials*)> callback, |
| 265 | base::Optional<AuthCredentials>* credentials) { |
| 266 | return OK; |
| 267 | } |
| 268 | |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 269 | TestURLRequestContext* |
| 270 | WebSocketTestURLRequestContextHost::GetURLRequestContext() { |
[email protected] | 65486614 | 2014-06-24 22:53:31 | [diff] [blame] | 271 | if (!url_request_context_initialized_) { |
| 272 | url_request_context_.Init(); |
| 273 | // A Network Delegate is required to make the URLRequest::Delegate work. |
| 274 | url_request_context_.set_network_delegate(&network_delegate_); |
| 275 | url_request_context_initialized_ = true; |
| 276 | } |
[email protected] | a31ecc0 | 2013-12-05 08:30:55 | [diff] [blame] | 277 | return &url_request_context_; |
| 278 | } |
| 279 | |
Adam Rice | 6f75c0f | 2018-06-04 08:00:05 | [diff] [blame] | 280 | void TestWebSocketStreamRequestAPI::OnBasicHandshakeStreamCreated( |
| 281 | WebSocketBasicHandshakeStream* handshake_stream) { |
| 282 | handshake_stream->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); |
Bence Béky | dca6bd9 | 2018-01-30 13:43:06 | [diff] [blame] | 283 | } |
| 284 | |
Adam Rice | 6f75c0f | 2018-06-04 08:00:05 | [diff] [blame] | 285 | void TestWebSocketStreamRequestAPI::OnHttp2HandshakeStreamCreated( |
| 286 | WebSocketHttp2HandshakeStream* handshake_stream) {} |
| 287 | |
[email protected] | ce9f7ffd | 2013-10-11 06:04:11 | [diff] [blame] | 288 | } // namespace net |