| 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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 // If in future the implementation type returned by CreateBasicStream() | 99 // If in future the implementation type returned by CreateBasicStream() |
| 100 // changes, this static_cast will be wrong. However, in that case the test | 100 // changes, this static_cast will be wrong. However, in that case the test |
| 101 // will fail and AddressSanitizer should identify the issue. | 101 // will fail and AddressSanitizer should identify the issue. |
| 102 static_cast<WebSocketBasicHandshakeStream*>(handshake.get()) | 102 static_cast<WebSocketBasicHandshakeStream*>(handshake.get()) |
| 103 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); | 103 ->SetWebSocketKeyForTesting("dGhlIHNhbXBsZSBub25jZQ=="); |
| 104 | 104 |
| 105 HttpRequestInfo request_info; | 105 HttpRequestInfo request_info; |
| 106 request_info.url = GURL(socket_url); | 106 request_info.url = GURL(socket_url); |
| 107 request_info.method = "GET"; | 107 request_info.method = "GET"; |
| 108 request_info.load_flags = LOAD_DISABLE_CACHE | LOAD_DO_NOT_PROMPT_FOR_LOGIN; | 108 request_info.load_flags = LOAD_DISABLE_CACHE; |
| 109 int rv = handshake->InitializeStream( | 109 int rv = handshake->InitializeStream( |
| 110 &request_info, DEFAULT_PRIORITY, BoundNetLog(), CompletionCallback()); | 110 &request_info, DEFAULT_PRIORITY, BoundNetLog(), CompletionCallback()); |
| 111 EXPECT_EQ(OK, rv); | 111 EXPECT_EQ(OK, rv); |
| 112 | 112 |
| 113 HttpRequestHeaders headers; | 113 HttpRequestHeaders headers; |
| 114 headers.SetHeader("Host", "localhost"); | 114 headers.SetHeader("Host", "localhost"); |
| 115 headers.SetHeader("Connection", "Upgrade"); | 115 headers.SetHeader("Connection", "Upgrade"); |
| 116 headers.SetHeader("Pragma", "no-cache"); | 116 headers.SetHeader("Pragma", "no-cache"); |
| 117 headers.SetHeader("Cache-Control", "no-cache"); | 117 headers.SetHeader("Cache-Control", "no-cache"); |
| 118 headers.SetHeader("Upgrade", "websocket"); | 118 headers.SetHeader("Upgrade", "websocket"); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 EXPECT_EQ( | 196 EXPECT_EQ( |
| 197 "permessage-deflate;" | 197 "permessage-deflate;" |
| 198 " client_max_window_bits=14; server_max_window_bits=14;" | 198 " client_max_window_bits=14; server_max_window_bits=14;" |
| 199 " server_no_context_takeover; client_no_context_takeover", | 199 " server_no_context_takeover; client_no_context_takeover", |
| 200 stream->GetExtensions()); | 200 stream->GetExtensions()); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace | 203 } // namespace |
| 204 } // namespace net | 204 } // namespace net |
| OLD | NEW |