| 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_test_util.h" | 5 #include "net/websockets/websocket_test_util.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "net/socket/socket_test_util.h" | 9 #include "net/socket/socket_test_util.h" |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 std::string WebSocketStandardRequest(const std::string& path, | 30 std::string WebSocketStandardRequest(const std::string& path, |
| 31 const std::string& origin, | 31 const std::string& origin, |
| 32 const std::string& extra_headers) { | 32 const std::string& extra_headers) { |
| 33 // Unrelated changes in net/http may change the order and default-values of | 33 // Unrelated changes in net/http may change the order and default-values of |
| 34 // HTTP headers, causing WebSocket tests to fail. It is safe to update this | 34 // HTTP headers, causing WebSocket tests to fail. It is safe to update this |
| 35 // string in that case. | 35 // string in that case. |
| 36 return base::StringPrintf( | 36 return base::StringPrintf( |
| 37 "GET %s HTTP/1.1\r\n" | 37 "GET %s HTTP/1.1\r\n" |
| 38 "Host: localhost\r\n" | 38 "Host: localhost\r\n" |
| 39 "Connection: Upgrade\r\n" | 39 "Connection: Upgrade\r\n" |
| 40 "Pragma: no-cache\r\n" |
| 41 "Cache-Control: no-cache\r\n" |
| 40 "Upgrade: websocket\r\n" | 42 "Upgrade: websocket\r\n" |
| 41 "Origin: %s\r\n" | 43 "Origin: %s\r\n" |
| 42 "Sec-WebSocket-Version: 13\r\n" | 44 "Sec-WebSocket-Version: 13\r\n" |
| 43 "User-Agent:\r\n" | 45 "User-Agent:\r\n" |
| 44 "Accept-Encoding: gzip,deflate\r\n" | 46 "Accept-Encoding: gzip,deflate\r\n" |
| 45 "Accept-Language: en-us,fr\r\n" | 47 "Accept-Language: en-us,fr\r\n" |
| 46 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" | 48 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" |
| 47 "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n" | 49 "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n" |
| 48 "%s\r\n", | 50 "%s\r\n", |
| 49 path.c_str(), | 51 path.c_str(), |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 125 |
| 124 TestURLRequestContext* | 126 TestURLRequestContext* |
| 125 WebSocketTestURLRequestContextHost::GetURLRequestContext() { | 127 WebSocketTestURLRequestContextHost::GetURLRequestContext() { |
| 126 url_request_context_.Init(); | 128 url_request_context_.Init(); |
| 127 // A Network Delegate is required to make the URLRequest::Delegate work. | 129 // A Network Delegate is required to make the URLRequest::Delegate work. |
| 128 url_request_context_.set_network_delegate(&network_delegate_); | 130 url_request_context_.set_network_delegate(&network_delegate_); |
| 129 return &url_request_context_; | 131 return &url_request_context_; |
| 130 } | 132 } |
| 131 | 133 |
| 132 } // namespace net | 134 } // namespace net |
| OLD | NEW |