Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(588)

Unified Diff: net/proxy/proxy_service_unittest.cc

Issue 6831025: Adds support for the DHCP portion of the WPAD (proxy auto-discovery) protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix issue found by unit testing on a slow machine. Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« net/proxy/dhcp_proxy_script_fetcher_win.cc ('K') | « net/proxy/proxy_service.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« net/proxy/dhcp_proxy_script_fetcher_win.cc ('K') | « net/proxy/proxy_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698