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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 return base::StringPrintf( | 41 return base::StringPrintf( |
42 "GET %s HTTP/1.1\r\n" | 42 "GET %s HTTP/1.1\r\n" |
43 "Host: localhost\r\n" | 43 "Host: localhost\r\n" |
44 "Connection: Upgrade\r\n" | 44 "Connection: Upgrade\r\n" |
45 "Pragma: no-cache\r\n" | 45 "Pragma: no-cache\r\n" |
46 "Cache-Control: no-cache\r\n" | 46 "Cache-Control: no-cache\r\n" |
47 "Upgrade: websocket\r\n" | 47 "Upgrade: websocket\r\n" |
48 "Origin: %s\r\n" | 48 "Origin: %s\r\n" |
49 "Sec-WebSocket-Version: 13\r\n" | 49 "Sec-WebSocket-Version: 13\r\n" |
50 "User-Agent:\r\n" | 50 "User-Agent:\r\n" |
51 "Accept-Encoding: gzip,deflate\r\n" | 51 "Accept-Encoding: gzip, deflate\r\n" |
52 "Accept-Language: en-us,fr\r\n" | 52 "Accept-Language: en-us,fr\r\n" |
53 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" | 53 "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r\n" |
54 "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n" | 54 "Sec-WebSocket-Extensions: permessage-deflate; client_max_window_bits\r\n" |
55 "%s\r\n", | 55 "%s\r\n", |
56 path.c_str(), | 56 path.c_str(), |
57 origin.c_str(), | 57 origin.c_str(), |
58 extra_headers.c_str()); | 58 extra_headers.c_str()); |
59 } | 59 } |
60 | 60 |
61 std::string WebSocketStandardResponse(const std::string& extra_headers) { | 61 std::string WebSocketStandardResponse(const std::string& extra_headers) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 if (!url_request_context_initialized_) { | 157 if (!url_request_context_initialized_) { |
158 url_request_context_.Init(); | 158 url_request_context_.Init(); |
159 // A Network Delegate is required to make the URLRequest::Delegate work. | 159 // A Network Delegate is required to make the URLRequest::Delegate work. |
160 url_request_context_.set_network_delegate(&network_delegate_); | 160 url_request_context_.set_network_delegate(&network_delegate_); |
161 url_request_context_initialized_ = true; | 161 url_request_context_initialized_ = true; |
162 } | 162 } |
163 return &url_request_context_; | 163 return &url_request_context_; |
164 } | 164 } |
165 | 165 |
166 } // namespace net | 166 } // namespace net |
OLD | NEW |