Chromium Code Reviews| Index: net/proxy/proxy_service.h |
| diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h |
| index 41eabb33c2160148519d8de4a2949b8e50906f38..5f70062cd96ae3842b39ee9316862d739d7ab946 100644 |
| --- a/net/proxy/proxy_service.h |
| +++ b/net/proxy/proxy_service.h |
| @@ -32,6 +32,7 @@ class DhcpProxyScriptFetcher; |
| class HostResolver; |
| class NetworkDelegate; |
| class ProxyResolver; |
| +class ProxyResolverScriptData; |
| class ProxyScriptDecider; |
| class ProxyScriptFetcher; |
| @@ -42,6 +43,13 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver, |
| public ProxyConfigService::Observer, |
| NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| public: |
| + // Only used by unit-tests. |
| + enum PollPolicy { |
| + POLL_POLICY_REGULAR, // Normal PAC poll policy (retry periodically). |
| + POLL_POLICY_NEVER, // Don't re-fetch PAC scripts for changes. |
| + POLL_POLICY_IMMEDIATE, // Check every 1 ms. |
| + }; |
| + |
| // The instance takes ownership of |config_service| and |resolver|. |
| // |net_log| is a possibly NULL destination to send log events to. It must |
| // remain alive for the lifetime of this ProxyService. |
| @@ -236,11 +244,16 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver, |
| stall_proxy_auto_config_delay_ = delay; |
| } |
| + // This method should only be used by unit tests. Returns the currently |
| + // active policy. |
|
wtc
2012/01/03 23:54:45
Nit: currently active => previously active ?
eroman
2012/01/04 03:41:47
Done.
|
| + static PollPolicy set_pac_script_poll_policy(PollPolicy policy); |
| + |
| private: |
| FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); |
| FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); |
| friend class PacRequest; |
| class InitProxyResolver; |
| + class ProxyScriptDeciderPoller; |
| // TODO(eroman): change this to a std::set. Note that this requires updating |
| // some tests in proxy_service_unittest.cc such as: |
| @@ -300,6 +313,12 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver, |
| // Start initialization using |fetched_config_|. |
| void InitializeUsingLastFetchedConfig(); |
| + // Start the initialization skipping past the "decision" phase. |
| + void InitializeUsingDecidedConfig( |
| + int decider_result, |
| + ProxyResolverScriptData* script_data, |
| + const ProxyConfig& effective_config); |
| + |
| // NetworkChangeNotifier::IPAddressObserver |
| // When this is called, we re-fetch PAC scripts and re-run WPAD. |
| virtual void OnIPAddressChanged() OVERRIDE; |
| @@ -347,6 +366,7 @@ class NET_EXPORT ProxyService : public NetworkChangeNotifier::IPAddressObserver, |
| // Note that the declaration is important here: |proxy_script_fetcher_| and |
| // |proxy_resolver_| must outlive |init_proxy_resolver_|. |
| scoped_ptr<InitProxyResolver> init_proxy_resolver_; |
| + scoped_ptr<ProxyScriptDeciderPoller> script_poller_; |
|
wtc
2012/01/03 23:54:45
Nit: should we document this member?
eroman
2012/01/04 03:41:47
Done.
|
| State current_state_; |