| 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 6ca77a5015dfee2fd80aa516ea1922407d2d6154..5b9e6107dbfa615e8749a7f2a68c8a3bd19a0a47 100644
|
| --- a/net/base/layered_network_delegate_unittest.cc
|
| +++ b/net/base/layered_network_delegate_unittest.cc
|
| @@ -13,21 +13,20 @@
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "net/base/auth.h"
|
| #include "net/base/net_errors.h"
|
| #include "net/base/network_delegate_impl.h"
|
| #include "net/base/request_priority.h"
|
| #include "net/base/test_completion_callback.h"
|
| #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"
|
| #include "url/gurl.h"
|
|
|
| namespace net {
|
| namespace {
|
|
|
| typedef std::map<const char*, int> CountersMap;
|
|
|
| @@ -39,31 +38,20 @@ class TestNetworkDelegateImpl : public NetworkDelegateImpl {
|
| ~TestNetworkDelegateImpl() override {}
|
|
|
| // NetworkDelegateImpl implementation:
|
| int OnBeforeURLRequest(URLRequest* request,
|
| const CompletionCallback& callback,
|
| 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,
|
| const CompletionCallback& callback,
|
| HttpRequestHeaders* headers) override {
|
| IncrementAndCompareCounter("on_before_send_headers_count");
|
| return OK;
|
| }
|
|
|
| void OnBeforeSendProxyHeaders(URLRequest* request,
|
| const ProxyInfo& proxy_info,
|
| HttpRequestHeaders* headers) override {
|
| @@ -184,27 +172,23 @@ class TestLayeredNetworkDelegate : public LayeredNetworkDelegate {
|
| ~TestLayeredNetworkDelegate() override {}
|
|
|
| void CallAndVerify() {
|
| scoped_refptr<AuthChallengeInfo> auth_challenge(new AuthChallengeInfo());
|
| scoped_ptr<URLRequest> request =
|
| context_.CreateRequest(GURL(), IDLE, &delegate_);
|
| scoped_ptr<HttpRequestHeaders> request_headers(new HttpRequestHeaders());
|
| 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());
|
| OnSendHeaders(NULL, *request_headers);
|
| OnNetworkBytesSent(request.get(), 42);
|
| EXPECT_EQ(OK, OnHeadersReceived(NULL, completion_callback.callback(),
|
| response_headers.get(), NULL, NULL));
|
| OnResponseStarted(request.get());
|
| OnNetworkBytesReceived(request.get(), 42);
|
| OnCompleted(request.get(), false);
|
| @@ -222,34 +206,20 @@ class TestLayeredNetworkDelegate : public LayeredNetworkDelegate {
|
| }
|
|
|
| protected:
|
| void OnBeforeURLRequestInternal(URLRequest* request,
|
| const CompletionCallback& callback,
|
| GURL* new_url) override {
|
| ++(*counters_)["on_before_url_request_count"];
|
| 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 {
|
| ++(*counters_)["on_before_send_headers_count"];
|
| EXPECT_EQ(1, (*counters_)["on_before_send_headers_count"]);
|
| }
|
|
|
| void OnBeforeSendProxyHeadersInternal(URLRequest* request,
|
| const ProxyInfo& proxy_info,
|
| HttpRequestHeaders* headers) override {
|
|
|