| Index: net/base/mock_host_resolver.h
|
| diff --git a/net/base/mock_host_resolver.h b/net/base/mock_host_resolver.h
|
| index 033cf147527769bbd3a9cd7eae464a7a7b306037..a2c82c7bff0da8ca51eeacba3d7b9eb9d1d57936 100644
|
| --- a/net/base/mock_host_resolver.h
|
| +++ b/net/base/mock_host_resolver.h
|
| @@ -65,6 +65,14 @@ class MockHostResolverBase : public HostResolver,
|
| synchronous_mode_ = is_synchronous;
|
| }
|
|
|
| + // Asynchronous requests are automatically resolved when this is set to true,
|
| + // which is the default. When set to false, Resolve() returns IO_PENDING and
|
| + // ResolveAllPending() must be explicitly invoked to resolve all requests that
|
| + // are pending.
|
| + void set_resolve_automatically(bool resolve_automatically) {
|
| + resolve_automatically_ = resolve_automatically;
|
| + }
|
| +
|
| // HostResolver methods:
|
| virtual int Resolve(const RequestInfo& info,
|
| AddressList* addresses,
|
| @@ -77,6 +85,15 @@ class MockHostResolverBase : public HostResolver,
|
| virtual void CancelRequest(RequestHandle req) OVERRIDE;
|
| virtual HostCache* GetHostCache() OVERRIDE;
|
|
|
| + // Resolves all pending requests. It is only valid to invoked this if
|
| + // set_resolve_automatically(false) was set before. The requests are resolved
|
| + // asynchronously, after this call returns.
|
| + void ResolveAllPending();
|
| +
|
| + // Returns true if there are pending requests that can be resolved by invoking
|
| + // ResolveAllPending().
|
| + bool has_pending_requests() const { return !requests_.empty(); }
|
| +
|
| protected:
|
| explicit MockHostResolverBase(bool use_caching);
|
|
|
| @@ -94,6 +111,7 @@ class MockHostResolverBase : public HostResolver,
|
| void ResolveNow(size_t id);
|
|
|
| bool synchronous_mode_;
|
| + bool resolve_automatically_;
|
| scoped_refptr<RuleBasedHostResolverProc> rules_;
|
| scoped_ptr<HostCache> cache_;
|
| RequestMap requests_;
|
|
|