| 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 26 matching lines...) Expand all Loading... |
| 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 "Upgrade: websocket\r\n" | 40 "Upgrade: websocket\r\n" |
| 41 "Origin: %s\r\n" | 41 "Origin: %s\r\n" |
| 42 "Sec-WebSocket-Version: 13\r\n" | 42 "Sec-WebSocket-Version: 13\r\n" |
| 43 "User-Agent:\r\n" | 43 "User-Agent:\r\n" |
| 44 "Accept-Encoding: gzip,deflate\r\n" | 44 "Accept-Encoding: gzip,deflate\r\n" |
| 45 "Accept-Language: en-us,fr\r\n" | 45 "Accept-Language: en-us,fr\r\n" |
| 46 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" | 46 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" |
| 47 "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n" |
| 47 "%s\r\n", | 48 "%s\r\n", |
| 48 path.c_str(), | 49 path.c_str(), |
| 49 origin.c_str(), | 50 origin.c_str(), |
| 50 extra_headers.c_str()); | 51 extra_headers.c_str()); |
| 51 } | 52 } |
| 52 | 53 |
| 53 std::string WebSocketStandardResponse(const std::string& extra_headers) { | 54 std::string WebSocketStandardResponse(const std::string& extra_headers) { |
| 54 return base::StringPrintf( | 55 return base::StringPrintf( |
| 55 "HTTP/1.1 101 Switching Protocols\r\n" | 56 "HTTP/1.1 101 Switching Protocols\r\n" |
| 56 "Upgrade: websocket\r\n" | 57 "Upgrade: websocket\r\n" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 117 |
| 117 TestURLRequestContext* | 118 TestURLRequestContext* |
| 118 WebSocketTestURLRequestContextHost::GetURLRequestContext() { | 119 WebSocketTestURLRequestContextHost::GetURLRequestContext() { |
| 119 url_request_context_.Init(); | 120 url_request_context_.Init(); |
| 120 // A Network Delegate is required to make the URLRequest::Delegate work. | 121 // A Network Delegate is required to make the URLRequest::Delegate work. |
| 121 url_request_context_.set_network_delegate(&network_delegate_); | 122 url_request_context_.set_network_delegate(&network_delegate_); |
| 122 return &url_request_context_; | 123 return &url_request_context_; |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace net | 126 } // namespace net |
| OLD | NEW |