Chromium Code Reviews| 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "net/url_request/url_request_test_util.h" | 12 #include "net/url_request/url_request_test_util.h" |
| 13 #include "net/websockets/websocket_stream.h" | 13 #include "net/websockets/websocket_stream.h" |
| 14 | 14 |
| 15 class GURL; | 15 class GURL; |
| 16 | 16 |
| 17 namespace base { | 17 namespace base { |
| 18 class Timer; | 18 class Timer; |
| 19 } // namespace base | 19 } // namespace base |
| 20 | 20 |
| 21 namespace url { | 21 namespace url { |
| 22 class Origin; | 22 class Origin; |
| 23 } // namespace url | 23 } // namespace url |
| 24 | 24 |
| 25 namespace net { | 25 namespace net { |
| 26 | 26 |
| 27 class BoundNetLog; | 27 class BoundNetLog; |
| 28 class DeterministicMockClientSocketFactory; | 28 class DeterministicMockClientSocketFactory; |
| 29 class DeterministicSocketData; | 29 class DeterministicSocketData; |
|
yhirano
2015/02/06 04:27:01
+ class ProxyService;
Adam Rice
2015/02/06 08:06:14
Done.
| |
| 30 class URLRequestContext; | 30 class URLRequestContext; |
| 31 class WebSocketHandshakeStreamCreateHelper; | 31 class WebSocketHandshakeStreamCreateHelper; |
| 32 struct SSLSocketDataProvider; | 32 struct SSLSocketDataProvider; |
| 33 | 33 |
| 34 class LinearCongruentialGenerator { | 34 class LinearCongruentialGenerator { |
| 35 public: | 35 public: |
| 36 explicit LinearCongruentialGenerator(uint32 seed); | 36 explicit LinearCongruentialGenerator(uint32 seed); |
| 37 uint32 Generate(); | 37 uint32 Generate(); |
| 38 | 38 |
| 39 private: | 39 private: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 const std::string& return_to_read) { | 116 const std::string& return_to_read) { |
| 117 maker_.SetExpectations(expect_written, return_to_read); | 117 maker_.SetExpectations(expect_written, return_to_read); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void AddRawExpectations(scoped_ptr<DeterministicSocketData> socket_data); | 120 void AddRawExpectations(scoped_ptr<DeterministicSocketData> socket_data); |
| 121 | 121 |
| 122 // Allow an SSL socket data provider to be added. | 122 // Allow an SSL socket data provider to be added. |
| 123 void AddSSLSocketDataProvider( | 123 void AddSSLSocketDataProvider( |
| 124 scoped_ptr<SSLSocketDataProvider> ssl_socket_data); | 124 scoped_ptr<SSLSocketDataProvider> ssl_socket_data); |
| 125 | 125 |
| 126 // Allow a proxy to be set. Usage: | |
| 127 // SetProxyService(make_scoped_ptr(ProxyService::CreateFixed("pro1:8000"))) | |
| 128 // Must be called prior to GetURLRequestContext(). | |
| 129 void SetProxyService(scoped_ptr<ProxyService> proxy_service); | |
| 130 | |
| 126 // Call after calling one of SetExpections() or AddRawExpectations(). The | 131 // Call after calling one of SetExpections() or AddRawExpectations(). The |
| 127 // returned pointer remains owned by this object. | 132 // returned pointer remains owned by this object. |
| 128 TestURLRequestContext* GetURLRequestContext(); | 133 TestURLRequestContext* GetURLRequestContext(); |
| 129 | 134 |
| 130 private: | 135 private: |
| 131 WebSocketDeterministicMockClientSocketFactoryMaker maker_; | 136 WebSocketDeterministicMockClientSocketFactoryMaker maker_; |
| 132 TestURLRequestContext url_request_context_; | 137 TestURLRequestContext url_request_context_; |
| 133 TestNetworkDelegate network_delegate_; | 138 TestNetworkDelegate network_delegate_; |
| 134 bool url_request_context_initialized_; | 139 bool url_request_context_initialized_; |
| 135 | 140 |
| 136 DISALLOW_COPY_AND_ASSIGN(WebSocketTestURLRequestContextHost); | 141 DISALLOW_COPY_AND_ASSIGN(WebSocketTestURLRequestContextHost); |
| 137 }; | 142 }; |
| 138 | 143 |
| 139 } // namespace net | 144 } // namespace net |
| 140 | 145 |
| 141 #endif // NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ | 146 #endif // NET_WEBSOCKETS_WEBSOCKET_TEST_UTIL_H_ |
| OLD | NEW |