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

Unified Diff: components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc

Issue 407093011: Allow URLRequests from one context to have different NetworkDelegates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix mojo Created 6 years, 4 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/browser/data_reduction_proxy_protocol_unittest.cc
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc
index e835c4d7f082f8b6c8991767b908bb8d487a9b02..6ecbf472879c94c08b0c9122a9a1f1b70159c9a1 100644
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_protocol_unittest.cc
@@ -197,26 +197,27 @@ class DataReductionProxyProtocolTest : public testing::Test {
const std::string& value,
bool expected_retry) {
TestDelegate d;
- URLRequest r(GURL("http://www.google.com/"),
- net::DEFAULT_PRIORITY,
- &d,
- context_.get());
- r.set_method(method);
- r.SetLoadFlags(net::LOAD_NORMAL);
-
- r.Start();
+ scoped_ptr<URLRequest> r(context_->CreateRequest(
+ GURL("http://www.google.com/"),
+ net::DEFAULT_PRIORITY,
+ &d,
+ NULL));
+ r->set_method(method);
+ r->SetLoadFlags(net::LOAD_NORMAL);
+
+ r->Start();
base::RunLoop().Run();
- EXPECT_EQ(net::URLRequestStatus::SUCCESS, r.status().status());
- EXPECT_EQ(net::OK, r.status().error());
+ EXPECT_EQ(net::URLRequestStatus::SUCCESS, r->status().status());
+ EXPECT_EQ(net::OK, r->status().error());
if (expected_retry)
- EXPECT_EQ(2U, r.url_chain().size());
+ EXPECT_EQ(2U, r->url_chain().size());
else
- EXPECT_EQ(1U, r.url_chain().size());
+ EXPECT_EQ(1U, r->url_chain().size());
if (!header.empty()) {
// We also have a server header here that isn't set by the proxy.
- EXPECT_TRUE(r.response_headers()->HasHeaderValue(header, value));
+ EXPECT_TRUE(r->response_headers()->HasHeaderValue(header, value));
}
EXPECT_EQ(content, d.data_received());
@@ -247,8 +248,7 @@ class DataReductionProxyProtocolTest : public testing::Test {
if (duration_seconds == 0) {
expected_min_duration = base::TimeDelta::FromMinutes(1);
expected_max_duration = base::TimeDelta::FromMinutes(5);
- }
- else {
+ } else {
expected_min_duration = base::TimeDelta::FromSeconds(duration_seconds);
expected_max_duration = base::TimeDelta::FromSeconds(duration_seconds);
}
@@ -627,18 +627,19 @@ TEST_F(DataReductionProxyProtocolTest,
mock_socket_factory_.AddSocketDataProvider(&data1);
TestDelegate d;
- URLRequest r(GURL("http://www.google.com/"),
- net::DEFAULT_PRIORITY,
- &d,
- context_.get());
- r.set_method("GET");
- r.SetLoadFlags(net::LOAD_NORMAL);
+ scoped_ptr<URLRequest> r(context_->CreateRequest(
+ GURL("http://www.google.com/"),
+ net::DEFAULT_PRIORITY,
+ &d,
+ NULL));
+ r->set_method("GET");
+ r->SetLoadFlags(net::LOAD_NORMAL);
- r.Start();
- base::RunLoop().Run();
+ r->Start();
+ base::RunLoop().Run();
- EXPECT_EQ(net::URLRequestStatus::SUCCESS, r.status().status());
- EXPECT_EQ(net::OK, r.status().error());
+ EXPECT_EQ(net::URLRequestStatus::SUCCESS, r->status().status());
+ EXPECT_EQ(net::OK, r->status().error());
EXPECT_EQ("Bypass message", d.data_received());
@@ -684,7 +685,7 @@ TEST_F(DataReductionProxyProtocolTest, OnResolveProxyHandler) {
OnResolveProxyHandler(url, load_flags, &test_params, &info1);
EXPECT_FALSE(info1.is_direct());
- OnResolveProxyHandler(url, load_flags, &test_params,&info2);
+ OnResolveProxyHandler(url, load_flags, &test_params, &info2);
EXPECT_FALSE(info2.is_direct());
load_flags |= net::LOAD_BYPASS_DATA_REDUCTION_PROXY;

Powered by Google App Engine
This is Rietveld 408576698