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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc

Issue 1680893002: Moving proxy resolution logic out of NetworkDelegate and into ProxyDelegate for DataReductionProxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
index e1c1f46775c832425d27e7af128bbab2a34a5157..0deda3db083cab49ebd54649e45707ea72e92332 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats_unittest.cc
@@ -22,20 +22,21 @@
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_prefs.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test_utils.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers_test_utils.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_params_test_utils.h"
#include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_names.h"
#include "components/prefs/testing_pref_service.h"
#include "net/base/host_port_pair.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
+#include "net/base/proxy_delegate.h"
#include "net/base/request_priority.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_util.h"
#include "net/log/net_log.h"
#include "net/socket/socket_test_util.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_context_storage.h"
#include "net/url_request/url_request_intercepting_job_factory.h"
@@ -554,20 +555,22 @@ class DataReductionProxyBypassStatsEndToEndTest : public testing::Test {
// to cause one proxy fallback in order for the data reduction proxy to be
// fully bypassed.
drp_test_context_ =
DataReductionProxyTestContext::Builder()
.WithParamsFlags(DataReductionProxyParams::kAllowed)
.WithURLRequestContext(&context_)
.WithMockClientSocketFactory(&mock_socket_factory_)
.Build();
drp_test_context_->AttachToURLRequestContext(&context_storage_);
context_.set_client_socket_factory(&mock_socket_factory_);
+ proxy_delegate_ = drp_test_context_->io_data()->CreateProxyDelegate();
+ context_.set_proxy_delegate(proxy_delegate_.get());
}
// Create and execute a fake request using the data reduction proxy stack.
// Passing in nullptr for |retry_response_headers| indicates that the request
// is not expected to be retried.
void CreateAndExecuteRequest(const GURL& url,
const char* initial_response_headers,
const char* initial_response_body,
const char* retry_response_headers,
const char* retry_response_body) {
@@ -692,20 +695,21 @@ class DataReductionProxyBypassStatsEndToEndTest : public testing::Test {
}
net::TestDelegate* delegate() { return &delegate_; }
private:
base::MessageLoopForIO message_loop_;
net::TestDelegate delegate_;
net::MockClientSocketFactory mock_socket_factory_;
net::TestURLRequestContext context_;
net::URLRequestContextStorage context_storage_;
+ scoped_ptr<net::ProxyDelegate> proxy_delegate_;
scoped_ptr<DataReductionProxyTestContext> drp_test_context_;
};
TEST_F(DataReductionProxyBypassStatsEndToEndTest, BypassedBytesNoRetry) {
struct TestCase {
GURL url;
const char* histogram_name;
const char* initial_response_headers;
};
const TestCase test_cases[] = {

Powered by Google App Engine
This is Rietveld 408576698