OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_BASE_TEST_PROXY_DELEGATE_H_ |
| 6 #define NET_BASE_TEST_PROXY_DELEGATE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "net/base/host_port_pair.h" |
| 11 #include "net/base/proxy_delegate.h" |
| 12 #include "net/proxy/proxy_server.h" |
| 13 |
| 14 class GURL; |
| 15 |
| 16 namespace net { |
| 17 |
| 18 class HttpRequestHeaders; |
| 19 class HttpResponseHeaders; |
| 20 class ProxyInfo; |
| 21 class ProxyService; |
| 22 class URLRequest; |
| 23 |
| 24 class TestProxyDelegate : public ProxyDelegate { |
| 25 public: |
| 26 TestProxyDelegate(); |
| 27 ~TestProxyDelegate() override; |
| 28 |
| 29 bool on_before_tunnel_request_called() const { |
| 30 return on_before_tunnel_request_called_; |
| 31 } |
| 32 |
| 33 bool on_tunnel_request_completed_called() const { |
| 34 return on_tunnel_request_completed_called_; |
| 35 } |
| 36 |
| 37 bool on_tunnel_headers_received_called() const { |
| 38 return on_tunnel_headers_received_called_; |
| 39 } |
| 40 |
| 41 void set_trusted_spdy_proxy(const net::ProxyServer& proxy_server) { |
| 42 trusted_spdy_proxy_ = proxy_server; |
| 43 } |
| 44 |
| 45 void VerifyOnTunnelRequestCompleted(const std::string& endpoint, |
| 46 const std::string& proxy_server) const; |
| 47 |
| 48 void VerifyOnTunnelHeadersReceived(const std::string& origin, |
| 49 const std::string& proxy_server, |
| 50 const std::string& status_line) const; |
| 51 |
| 52 // ProxyDelegate implementation: |
| 53 void OnResolveProxy(const GURL& url, |
| 54 int load_flags, |
| 55 const ProxyService& proxy_service, |
| 56 ProxyInfo* result) override; |
| 57 void OnTunnelConnectCompleted(const HostPortPair& endpoint, |
| 58 const HostPortPair& proxy_server, |
| 59 int net_error) override; |
| 60 void OnFallback(const ProxyServer& bad_proxy, int net_error) override; |
| 61 void OnBeforeSendHeaders(URLRequest* request, |
| 62 const ProxyInfo& proxy_info, |
| 63 HttpRequestHeaders* headers) override; |
| 64 void OnBeforeTunnelRequest(const HostPortPair& proxy_server, |
| 65 HttpRequestHeaders* extra_headers) override; |
| 66 void OnTunnelHeadersReceived( |
| 67 const HostPortPair& origin, |
| 68 const HostPortPair& proxy_server, |
| 69 const HttpResponseHeaders& response_headers) override; |
| 70 bool IsTrustedSpdyProxy(const net::ProxyServer& proxy_server) override; |
| 71 |
| 72 private: |
| 73 bool on_before_tunnel_request_called_; |
| 74 bool on_tunnel_request_completed_called_; |
| 75 bool on_tunnel_headers_received_called_; |
| 76 net::ProxyServer trusted_spdy_proxy_; |
| 77 HostPortPair on_tunnel_request_completed_endpoint_; |
| 78 HostPortPair on_tunnel_request_completed_proxy_server_; |
| 79 HostPortPair on_tunnel_headers_received_origin_; |
| 80 HostPortPair on_tunnel_headers_received_proxy_server_; |
| 81 std::string on_tunnel_headers_received_status_line_; |
| 82 }; |
| 83 |
| 84 } // namespace net |
| 85 |
| 86 #endif // NET_BASE_TEST_PROXY_DELEGATE_H_ |
OLD | NEW |