| Index: net/proxy/proxy_service_unittest.cc
|
| diff --git a/net/proxy/proxy_service_unittest.cc b/net/proxy/proxy_service_unittest.cc
|
| index 7326c6724d7b5cabb98a734b0c26d3a35b7c516b..7025ab0c630f839de70f00d022d1e5391d7c8e1a 100644
|
| --- a/net/proxy/proxy_service_unittest.cc
|
| +++ b/net/proxy/proxy_service_unittest.cc
|
| @@ -16,6 +16,7 @@
|
| #include "net/base/net_log_unittest.h"
|
| #include "net/base/test_completion_callback.h"
|
| #include "net/proxy/mock_proxy_resolver.h"
|
| +#include "net/proxy/mock_proxy_script_fetcher.h"
|
| #include "net/proxy/proxy_config_service.h"
|
| #include "net/proxy/proxy_resolver.h"
|
| #include "net/proxy/proxy_script_fetcher.h"
|
| @@ -67,53 +68,6 @@ class MockProxyConfigService: public ProxyConfigService {
|
|
|
| } // namespace
|
|
|
| -// A mock ProxyScriptFetcher. No result will be returned to the fetch client
|
| -// until we call NotifyFetchCompletion() to set the results.
|
| -class MockProxyScriptFetcher : public ProxyScriptFetcher {
|
| - public:
|
| - MockProxyScriptFetcher()
|
| - : pending_request_callback_(NULL), pending_request_text_(NULL) {
|
| - }
|
| -
|
| - // ProxyScriptFetcher implementation.
|
| - virtual int Fetch(const GURL& url,
|
| - string16* text,
|
| - CompletionCallback* callback) {
|
| - DCHECK(!has_pending_request());
|
| -
|
| - // Save the caller's information, and have them wait.
|
| - pending_request_url_ = url;
|
| - pending_request_callback_ = callback;
|
| - pending_request_text_ = text;
|
| - return ERR_IO_PENDING;
|
| - }
|
| -
|
| - void NotifyFetchCompletion(int result, const std::string& ascii_text) {
|
| - DCHECK(has_pending_request());
|
| - *pending_request_text_ = ASCIIToUTF16(ascii_text);
|
| - CompletionCallback* callback = pending_request_callback_;
|
| - pending_request_callback_ = NULL;
|
| - callback->Run(result);
|
| - }
|
| -
|
| - virtual void Cancel() {}
|
| -
|
| - virtual URLRequestContext* GetRequestContext() { return NULL; }
|
| -
|
| - const GURL& pending_request_url() const {
|
| - return pending_request_url_;
|
| - }
|
| -
|
| - bool has_pending_request() const {
|
| - return pending_request_callback_ != NULL;
|
| - }
|
| -
|
| - private:
|
| - GURL pending_request_url_;
|
| - CompletionCallback* pending_request_callback_;
|
| - string16* pending_request_text_;
|
| -};
|
| -
|
| TEST(ProxyServiceTest, Direct) {
|
| MockAsyncProxyResolver* resolver = new MockAsyncProxyResolver;
|
| scoped_refptr<ProxyService> service(
|
|
|