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

Unified Diff: net/base/layered_network_delegate_unittest.cc

Issue 1735203002: Revert of Moving proxy resolution logic out of NetworkDelegate and into ProxyDelegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « net/base/layered_network_delegate.cc ('k') | net/base/network_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/layered_network_delegate_unittest.cc
diff --git a/net/base/layered_network_delegate_unittest.cc b/net/base/layered_network_delegate_unittest.cc
index 5b9e6107dbfa615e8749a7f2a68c8a3bd19a0a47..6ca77a5015dfee2fd80aa516ea1922407d2d6154 100644
--- a/net/base/layered_network_delegate_unittest.cc
+++ b/net/base/layered_network_delegate_unittest.cc
@@ -20,6 +20,7 @@
#include "net/http/http_response_headers.h"
#include "net/proxy/proxy_config_service.h"
#include "net/proxy/proxy_info.h"
+#include "net/proxy/proxy_service.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -43,6 +44,17 @@
GURL* new_url) override {
IncrementAndCompareCounter("on_before_url_request_count");
return OK;
+ }
+
+ void OnResolveProxy(const GURL& url,
+ int load_flags,
+ const ProxyService& proxy_service,
+ ProxyInfo* result) override {
+ IncrementAndCompareCounter("on_resolve_proxy_count");
+ }
+
+ void OnProxyFallback(const ProxyServer& bad_proxy, int net_error) override {
+ IncrementAndCompareCounter("on_proxy_fallback_count");
}
int OnBeforeSendHeaders(URLRequest* request,
@@ -179,9 +191,13 @@
scoped_refptr<HttpResponseHeaders> response_headers(
new HttpResponseHeaders(""));
TestCompletionCallback completion_callback;
+ scoped_ptr<ProxyService> proxy_service(ProxyService::CreateDirect());
+ scoped_ptr<ProxyInfo> proxy_info(new ProxyInfo());
EXPECT_EQ(OK, OnBeforeURLRequest(request.get(),
completion_callback.callback(), NULL));
+ OnResolveProxy(GURL(), 0, *proxy_service, proxy_info.get());
+ OnProxyFallback(ProxyServer(), 0);
EXPECT_EQ(OK, OnBeforeSendHeaders(NULL, completion_callback.callback(),
request_headers.get()));
OnBeforeSendProxyHeaders(NULL, ProxyInfo(), request_headers.get());
@@ -213,6 +229,20 @@
EXPECT_EQ(1, (*counters_)["on_before_url_request_count"]);
}
+ void OnResolveProxyInternal(const GURL& url,
+ int load_flags,
+ const ProxyService& proxy_service,
+ ProxyInfo* result) override {
+ ++(*counters_)["on_resolve_proxy_count"];
+ EXPECT_EQ(1, (*counters_)["on_resolve_proxy_count"]);
+ }
+
+ void OnProxyFallbackInternal(const ProxyServer& bad_proxy,
+ int net_error) override {
+ ++(*counters_)["on_proxy_fallback_count"];
+ EXPECT_EQ(1, (*counters_)["on_proxy_fallback_count"]);
+ }
+
void OnBeforeSendHeadersInternal(URLRequest* request,
const CompletionCallback& callback,
HttpRequestHeaders* headers) override {
« no previous file with comments | « net/base/layered_network_delegate.cc ('k') | net/base/network_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698