| 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 #ifndef NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ |
| 6 #define NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 const url::Origin& origin, | 51 const url::Origin& origin, |
| 52 URLRequestContext* url_request_context, | 52 URLRequestContext* url_request_context, |
| 53 const BoundNetLog& net_log, | 53 const BoundNetLog& net_log, |
| 54 scoped_ptr<WebSocketStream::ConnectDelegate> connect_delegate, | 54 scoped_ptr<WebSocketStream::ConnectDelegate> connect_delegate, |
| 55 scoped_ptr<base::Timer> timer); | 55 scoped_ptr<base::Timer> timer); |
| 56 | 56 |
| 57 // Generates a standard WebSocket handshake request. The challenge key used is | 57 // Generates a standard WebSocket handshake request. The challenge key used is |
| 58 // "dGhlIHNhbXBsZSBub25jZQ==". Each header in |extra_headers| must be terminated | 58 // "dGhlIHNhbXBsZSBub25jZQ==". Each header in |extra_headers| must be terminated |
| 59 // with "\r\n". | 59 // with "\r\n". |
| 60 extern std::string WebSocketStandardRequest(const std::string& path, | 60 extern std::string WebSocketStandardRequest(const std::string& path, |
| 61 const std::string& host, |
| 61 const std::string& origin, | 62 const std::string& origin, |
| 62 const std::string& extra_headers); | 63 const std::string& extra_headers); |
| 63 | 64 |
| 64 // A response with the appropriate accept header to match the above challenge | 65 // A response with the appropriate accept header to match the above challenge |
| 65 // key. Each header in |extra_headers| must be terminated with "\r\n". | 66 // key. Each header in |extra_headers| must be terminated with "\r\n". |
| 66 extern std::string WebSocketStandardResponse(const std::string& extra_headers); | 67 extern std::string WebSocketStandardResponse(const std::string& extra_headers); |
| 67 | 68 |
| 68 // This class provides a convenient way to construct a | 69 // This class provides a convenient way to construct a |
| 69 // DeterministicMockClientSocketFactory for WebSocket tests. | 70 // DeterministicMockClientSocketFactory for WebSocket tests. |
| 70 class WebSocketDeterministicMockClientSocketFactoryMaker { | 71 class WebSocketDeterministicMockClientSocketFactoryMaker { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 TestURLRequestContext url_request_context_; | 132 TestURLRequestContext url_request_context_; |
| 132 TestNetworkDelegate network_delegate_; | 133 TestNetworkDelegate network_delegate_; |
| 133 bool url_request_context_initialized_; | 134 bool url_request_context_initialized_; |
| 134 | 135 |
| 135 DISALLOW_COPY_AND_ASSIGN(WebSocketTestURLRequestContextHost); | 136 DISALLOW_COPY_AND_ASSIGN(WebSocketTestURLRequestContextHost); |
| 136 }; | 137 }; |
| 137 | 138 |
| 138 } // namespace net | 139 } // namespace net |
| 139 | 140 |
| 140 #endif // NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ | 141 #endif // NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ |
| OLD | NEW |