| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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& host, |
| 62 const std::string& origin, | 62 const std::string& origin, |
| 63 const std::string& extra_headers); | 63 const std::string& extra_headers); |
| 64 | 64 |
| 65 // Generates a standard WebSocket handshake request. The challenge key used is |
| 66 // "dGhlIHNhbXBsZSBub25jZQ==". |cookies| must be empty or terminated with |
| 67 // "\r\n". Each header in |extra_headers| must be terminated with "\r\n". |
| 68 extern std::string WebSocketStandardRequestWithCookies( |
| 69 const std::string& path, |
| 70 const std::string& host, |
| 71 const std::string& origin, |
| 72 const std::string& cookies, |
| 73 const std::string& extra_headers); |
| 74 |
| 65 // A response with the appropriate accept header to match the above challenge | 75 // A response with the appropriate accept header to match the above challenge |
| 66 // key. Each header in |extra_headers| must be terminated with "\r\n". | 76 // key. Each header in |extra_headers| must be terminated with "\r\n". |
| 67 extern std::string WebSocketStandardResponse(const std::string& extra_headers); | 77 extern std::string WebSocketStandardResponse(const std::string& extra_headers); |
| 68 | 78 |
| 69 // This class provides a convenient way to construct a | 79 // This class provides a convenient way to construct a |
| 70 // DeterministicMockClientSocketFactory for WebSocket tests. | 80 // DeterministicMockClientSocketFactory for WebSocket tests. |
| 71 class WebSocketDeterministicMockClientSocketFactoryMaker { | 81 class WebSocketDeterministicMockClientSocketFactoryMaker { |
| 72 public: | 82 public: |
| 73 WebSocketDeterministicMockClientSocketFactoryMaker(); | 83 WebSocketDeterministicMockClientSocketFactoryMaker(); |
| 74 ~WebSocketDeterministicMockClientSocketFactoryMaker(); | 84 ~WebSocketDeterministicMockClientSocketFactoryMaker(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 TestURLRequestContext url_request_context_; | 142 TestURLRequestContext url_request_context_; |
| 133 TestNetworkDelegate network_delegate_; | 143 TestNetworkDelegate network_delegate_; |
| 134 bool url_request_context_initialized_; | 144 bool url_request_context_initialized_; |
| 135 | 145 |
| 136 DISALLOW_COPY_AND_ASSIGN(WebSocketTestURLRequestContextHost); | 146 DISALLOW_COPY_AND_ASSIGN(WebSocketTestURLRequestContextHost); |
| 137 }; | 147 }; |
| 138 | 148 |
| 139 } // namespace net | 149 } // namespace net |
| 140 | 150 |
| 141 #endif // NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ | 151 #endif // NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ |
| OLD | NEW |