Index: net/url_request/url_request_unittest.cc |
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc |
index 204f223c1724e6dede656a429db5a085a00e7676..2ebd9fff3b388f703847c4bd058f98121d1b0f29 100644 |
--- a/net/url_request/url_request_unittest.cc |
+++ b/net/url_request/url_request_unittest.cc |
@@ -406,9 +406,9 @@ class TestJobInterceptor : public URLRequestJobFactory::Interceptor { |
// Inherit PlatformTest since we require the autorelease pool on Mac OS X.f |
class URLRequestTest : public PlatformTest { |
public: |
- URLRequestTest() : default_context_(new TestURLRequestContext(true)) { |
- default_context_->set_network_delegate(&default_network_delegate_); |
- default_context_->Init(); |
+ URLRequestTest() : default_context_(true) { |
+ default_context_.set_network_delegate(&default_network_delegate_); |
+ default_context_.Init(); |
} |
static void SetUpTestCase() { |
@@ -418,15 +418,15 @@ class URLRequestTest : public PlatformTest { |
// Adds the TestJobInterceptor to the default context. |
TestJobInterceptor* AddTestInterceptor() { |
TestJobInterceptor* interceptor = new TestJobInterceptor(); |
- default_context_->set_job_factory(&job_factory_); |
+ default_context_.set_job_factory(&job_factory_); |
job_factory_.AddInterceptor(interceptor); |
return interceptor; |
} |
protected: |
TestNetworkDelegate default_network_delegate_; // must outlive URLRequest |
- scoped_refptr<TestURLRequestContext> default_context_; |
URLRequestJobFactory job_factory_; |
+ TestURLRequestContext default_context_; |
}; |
class URLRequestTestHTTP : public URLRequestTest { |
@@ -451,7 +451,7 @@ class URLRequestTestHTTP : public URLRequestTest { |
static const char kData[] = "hello world"; |
TestDelegate d; |
TestURLRequest req(redirect_url, &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method(request_method); |
if (include_data) { |
req.set_upload(CreateSimpleUploadData(kData).get()); |
@@ -497,7 +497,7 @@ class URLRequestTestHTTP : public URLRequestTest { |
for (int i = 0; i < kIterations; ++i) { |
TestDelegate d; |
URLRequest r(test_server_.GetURL("echo"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.set_method(method.c_str()); |
r.AppendBytesToUpload(uploadBytes, kMsgSize); |
@@ -554,15 +554,15 @@ TEST_F(URLRequestTestHTTP, FLAKY_ProxyTunnelRedirectTest) { |
ASSERT_TRUE(test_server_.Start()); |
TestNetworkDelegate network_delegate; // must outlive URLRequest |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->SetProxyFromString(test_server_.host_port_pair().ToString()); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.SetProxyFromString(test_server_.host_port_pair().ToString()); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
TestDelegate d; |
{ |
URLRequest r(GURL("https://www.redirect.com/"), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -584,15 +584,15 @@ TEST_F(URLRequestTestHTTP, DISABLED_NetworkDelegateTunnelConnectionFailed) { |
ASSERT_TRUE(test_server_.Start()); |
TestNetworkDelegate network_delegate; // must outlive URLRequest |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->SetProxyFromString(test_server_.host_port_pair().ToString()); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.SetProxyFromString(test_server_.host_port_pair().ToString()); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
TestDelegate d; |
{ |
URLRequest r(GURL("https://www.redirect.com/"), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -617,14 +617,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequest) { |
BlockingNetworkDelegate network_delegate; |
network_delegate.set_callback_retval(ERR_EMPTY_RESPONSE); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->SetProxyFromString(test_server_.host_port_pair().ToString()); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.SetProxyFromString(test_server_.host_port_pair().ToString()); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -645,14 +645,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelRequestSynchronously) { |
BlockingNetworkDelegate network_delegate; |
network_delegate.set_retval(ERR_EMPTY_RESPONSE); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->SetProxyFromString(test_server_.host_port_pair().ToString()); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.SetProxyFromString(test_server_.host_port_pair().ToString()); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -675,15 +675,15 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequest) { |
GURL redirect_url(test_server_.GetURL("simple.html")); |
network_delegate.set_redirect_url(redirect_url); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->SetProxyFromString(test_server_.host_port_pair().ToString()); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.SetProxyFromString(test_server_.host_port_pair().ToString()); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
GURL original_url(test_server_.GetURL("empty.html")); |
TestURLRequest r(original_url, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -710,15 +710,15 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestSynchronously) { |
network_delegate.set_redirect_url(redirect_url); |
network_delegate.set_retval(OK); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->SetProxyFromString(test_server_.host_port_pair().ToString()); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.SetProxyFromString(test_server_.host_port_pair().ToString()); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
GURL original_url(test_server_.GetURL("empty.html")); |
TestURLRequest r(original_url, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -745,14 +745,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateRedirectRequestPost) { |
GURL redirect_url(test_server_.GetURL("echo")); |
network_delegate.set_redirect_url(redirect_url); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
GURL original_url(test_server_.GetURL("empty.html")); |
TestURLRequest r(original_url, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.set_method("POST"); |
r.set_upload(CreateSimpleUploadData(kData).get()); |
HttpRequestHeaders headers; |
@@ -787,16 +787,16 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncNoAction) { |
network_delegate.set_auth_retval( |
NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
d.set_credentials(AuthCredentials(kUser, kSecret)); |
{ |
GURL url(test_server_.GetURL("auth-basic")); |
TestURLRequest r(url, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -822,14 +822,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncSetAuth) { |
network_delegate.set_auth_credentials(AuthCredentials(kUser, kSecret)); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
GURL url(test_server_.GetURL("auth-basic")); |
TestURLRequest r(url, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -853,14 +853,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredSyncCancel) { |
network_delegate.set_auth_retval( |
NetworkDelegate::AUTH_REQUIRED_RESPONSE_CANCEL_AUTH); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
GURL url(test_server_.GetURL("auth-basic")); |
TestURLRequest r(url, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -888,16 +888,16 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredAsyncNoAction) { |
network_delegate.set_auth_callback_retval( |
NetworkDelegate::AUTH_REQUIRED_RESPONSE_NO_ACTION); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
d.set_credentials(AuthCredentials(kUser, kSecret)); |
{ |
GURL url(test_server_.GetURL("auth-basic")); |
TestURLRequest r(url, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -926,14 +926,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredAsyncSetAuth) { |
AuthCredentials auth_credentials(kUser, kSecret); |
network_delegate.set_auth_credentials(auth_credentials); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
GURL url(test_server_.GetURL("auth-basic")); |
TestURLRequest r(url, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -960,14 +960,14 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateOnAuthRequiredAsyncCancel) { |
network_delegate.set_auth_callback_retval( |
NetworkDelegate::AUTH_REQUIRED_RESPONSE_CANCEL_AUTH); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
GURL url(test_server_.GetURL("auth-basic")); |
TestURLRequest r(url, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -992,13 +992,13 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting1) { |
network_delegate.BlockOn( |
BlockingNetworkDelegateWithManualCallback::ON_BEFORE_URL_REQUEST); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
network_delegate.WaitForState( |
@@ -1027,13 +1027,13 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting2) { |
network_delegate.BlockOn( |
BlockingNetworkDelegateWithManualCallback::ON_BEFORE_SEND_HEADERS); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
network_delegate.WaitForState( |
@@ -1062,13 +1062,13 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting3) { |
network_delegate.BlockOn( |
BlockingNetworkDelegateWithManualCallback::ON_HEADERS_RECEIVED); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
network_delegate.WaitForState( |
@@ -1097,13 +1097,13 @@ TEST_F(URLRequestTestHTTP, NetworkDelegateCancelWhileWaiting4) { |
network_delegate.BlockOn( |
BlockingNetworkDelegateWithManualCallback::ON_AUTH_REQUIRED); |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
{ |
TestURLRequest r(test_server_.GetURL("auth-basic"), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
network_delegate.WaitForState( |
@@ -1128,15 +1128,15 @@ TEST_F(URLRequestTestHTTP, UnexpectedServerAuthTest) { |
ASSERT_TRUE(test_server_.Start()); |
TestNetworkDelegate network_delegate; // must outlive URLRequest |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->SetProxyFromString(test_server_.host_port_pair().ToString()); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.SetProxyFromString(test_server_.host_port_pair().ToString()); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
TestDelegate d; |
{ |
URLRequest r(GURL("https://www.server-auth.com/"), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1154,7 +1154,7 @@ TEST_F(URLRequestTestHTTP, GetTest_NoCache) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1179,7 +1179,7 @@ TEST_F(URLRequestTestHTTP, GetTest) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1221,13 +1221,12 @@ TEST_F(URLRequestTestHTTP, GetZippedTest) { |
test_parameters[i]); |
TestNetworkDelegate network_delegate; // must outlive URLRequest |
- scoped_refptr<TestURLRequestContext> context( |
- new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
TestURLRequest r(test_server_.GetURL(test_file), &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1267,7 +1266,7 @@ TEST_F(URLRequestTestHTTP, DISABLED_HTTPSToHTTPRedirectNoRefererTest) { |
TestDelegate d; |
TestURLRequest req(https_test_server.GetURL( |
"server-redirect?" + http_destination.spec()), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_referrer("https://www.referrer.com/"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -1288,7 +1287,7 @@ TEST_F(URLRequestTestHTTP, MultipleRedirectTest) { |
"server-redirect?" + middle_redirect_url.spec()); |
TestDelegate d; |
TestURLRequest req(original_url, &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -1304,15 +1303,15 @@ TEST_F(URLRequestTestHTTP, MultipleRedirectTest) { |
class HTTPSRequestTest : public testing::Test { |
public: |
- HTTPSRequestTest() : default_context_(new TestURLRequestContext(true)) { |
- default_context_->set_network_delegate(&default_network_delegate_); |
- default_context_->Init(); |
+ HTTPSRequestTest() : default_context_(true) { |
+ default_context_.set_network_delegate(&default_network_delegate_); |
+ default_context_.Init(); |
} |
virtual ~HTTPSRequestTest() {} |
protected: |
TestNetworkDelegate default_network_delegate_; // must outlive URLRequest |
- scoped_refptr<TestURLRequestContext> default_context_; |
+ TestURLRequestContext default_context_; |
}; |
// This test was disabled because it made chrome_frame_net_tests hang |
@@ -1326,7 +1325,7 @@ TEST_F(HTTPSRequestTest, DISABLED_HTTPSGetTest) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server.GetURL(""), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1356,7 +1355,7 @@ TEST_F(HTTPSRequestTest, HTTPSMismatchedTest) { |
{ |
d.set_allow_certificate_errors(err_allowed); |
TestURLRequest r(test_server.GetURL(""), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1391,7 +1390,7 @@ TEST_F(HTTPSRequestTest, HTTPSExpiredTest) { |
{ |
d.set_allow_certificate_errors(err_allowed); |
TestURLRequest r(test_server.GetURL(""), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1446,15 +1445,15 @@ static const char kOCSPTestCertPolicy[] = "1.3.6.1.4.1.11129.2.4.1"; |
class HTTPSOCSPTest : public HTTPSRequestTest { |
public: |
HTTPSOCSPTest() |
- : context_(new TestURLRequestContext(true)), |
+ : context_(true), |
ev_test_policy_(EVRootCAMetadata::GetInstance(), |
kOCSPTestCertFingerprint, |
kOCSPTestCertPolicy) { |
} |
virtual void SetUp() OVERRIDE { |
- SetupContext(context_); |
- context_->Init(); |
+ SetupContext(&context_); |
+ context_.Init(); |
scoped_refptr<net::X509Certificate> root_cert = |
ImportCertFromFile(GetTestCertsDirectory(), "ocsp-test-root.pem"); |
@@ -1462,7 +1461,7 @@ class HTTPSOCSPTest : public HTTPSRequestTest { |
test_root_.reset(new ScopedTestRoot(root_cert)); |
#if defined(USE_NSS) |
- SetURLRequestContextForNSSHttpIO(context_.get()); |
+ SetURLRequestContextForNSSHttpIO(&context_); |
EnsureNSSHttpIOInit(); |
#endif |
} |
@@ -1476,7 +1475,7 @@ class HTTPSOCSPTest : public HTTPSRequestTest { |
TestDelegate d; |
d.set_allow_certificate_errors(true); |
URLRequest r(test_server.GetURL(""), &d); |
- r.set_context(context_.get()); |
+ r.set_context(&context_); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -1502,7 +1501,7 @@ class HTTPSOCSPTest : public HTTPSRequestTest { |
} |
scoped_ptr<ScopedTestRoot> test_root_; |
- scoped_refptr<TestURLRequestContext> context_; |
+ TestURLRequestContext context_; |
ScopedTestEVPolicy ev_test_policy_; |
}; |
@@ -1739,11 +1738,11 @@ TEST_F(HTTPSRequestTest, SSLv3Fallback) { |
ASSERT_TRUE(test_server.Start()); |
TestDelegate d; |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.Init(); |
d.set_allow_certificate_errors(true); |
URLRequest r(test_server.GetURL(""), &d); |
- r.set_context(context.get()); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -1771,18 +1770,18 @@ TEST_F(HTTPSRequestTest, HTTPSPreloadedHSTSTest) { |
MockHostResolver host_resolver; |
host_resolver.rules()->AddRule("www.google.com", "127.0.0.1"); |
TestNetworkDelegate network_delegate; // must outlive URLRequest |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->set_host_resolver(&host_resolver); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.set_host_resolver(&host_resolver); |
TransportSecurityState transport_security_state; |
- context->set_transport_security_state(&transport_security_state); |
- context->Init(); |
+ context.set_transport_security_state(&transport_security_state); |
+ context.Init(); |
TestDelegate d; |
TestURLRequest r(GURL(StringPrintf("https://www.google.com:%d", |
test_server.host_port_pair().port())), |
&d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1814,21 +1813,21 @@ TEST_F(HTTPSRequestTest, HTTPSErrorsNoClobberTSSTest) { |
MockHostResolver host_resolver; |
host_resolver.rules()->AddRule("www.google.com", "127.0.0.1"); |
TestNetworkDelegate network_delegate; // must outlive URLRequest |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->set_host_resolver(&host_resolver); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.set_host_resolver(&host_resolver); |
TransportSecurityState transport_security_state; |
TransportSecurityState::DomainState domain_state; |
EXPECT_TRUE(transport_security_state.GetDomainState("www.google.com", true, |
&domain_state)); |
- context->set_transport_security_state(&transport_security_state); |
- context->Init(); |
+ context.set_transport_security_state(&transport_security_state); |
+ context.Init(); |
TestDelegate d; |
TestURLRequest r(GURL(StringPrintf("https://www.google.com:%d", |
test_server.host_port_pair().port())), |
&d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1891,7 +1890,7 @@ TEST_F(HTTPSRequestTest, ClientAuthTest) { |
SSLClientAuthTestDelegate d; |
{ |
TestURLRequest r(test_server.GetURL(""), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1929,7 +1928,7 @@ TEST_F(HTTPSRequestTest, ResumeTest) { |
{ |
TestDelegate d; |
TestURLRequest r(test_server.GetURL("ssl-session-cache"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1939,13 +1938,13 @@ TEST_F(HTTPSRequestTest, ResumeTest) { |
EXPECT_EQ(1, d.response_started_count()); |
} |
- reinterpret_cast<HttpCache*>(default_context_->http_transaction_factory())-> |
+ reinterpret_cast<HttpCache*>(default_context_.http_transaction_factory())-> |
CloseAllConnections(); |
{ |
TestDelegate d; |
TestURLRequest r(test_server.GetURL("ssl-session-cache"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -1996,7 +1995,7 @@ TEST_F(HTTPSRequestTest, SSLSessionCacheShardTest) { |
{ |
TestDelegate d; |
TestURLRequest r(test_server.GetURL("ssl-session-cache"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -2008,26 +2007,26 @@ TEST_F(HTTPSRequestTest, SSLSessionCacheShardTest) { |
// Now create a new HttpCache with a different ssl_session_cache_shard value. |
HttpNetworkSession::Params params; |
- params.host_resolver = default_context_->host_resolver(); |
- params.cert_verifier = default_context_->cert_verifier(); |
- params.proxy_service = default_context_->proxy_service(); |
- params.ssl_config_service = default_context_->ssl_config_service(); |
+ params.host_resolver = default_context_.host_resolver(); |
+ params.cert_verifier = default_context_.cert_verifier(); |
+ params.proxy_service = default_context_.proxy_service(); |
+ params.ssl_config_service = default_context_.ssl_config_service(); |
params.http_auth_handler_factory = |
- default_context_->http_auth_handler_factory(); |
- params.network_delegate = default_context_->network_delegate(); |
- params.http_server_properties = default_context_->http_server_properties(); |
+ default_context_.http_auth_handler_factory(); |
+ params.network_delegate = default_context_.network_delegate(); |
+ params.http_server_properties = default_context_.http_server_properties(); |
params.ssl_session_cache_shard = "alternate"; |
scoped_ptr<net::HttpCache> cache(new net::HttpCache( |
new net::HttpNetworkSession(params), |
net::HttpCache::DefaultBackend::InMemory(0))); |
- default_context_->set_http_transaction_factory(cache.get()); |
+ default_context_.set_http_transaction_factory(cache.get()); |
{ |
TestDelegate d; |
TestURLRequest r(test_server.GetURL("ssl-session-cache"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -2065,7 +2064,7 @@ TEST_F(URLRequestTestHTTP, CancelTest) { |
TestDelegate d; |
{ |
TestURLRequest r(GURL("http://www.google.com/"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -2088,7 +2087,7 @@ TEST_F(URLRequestTestHTTP, CancelTest2) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
d.set_cancel_in_response_started(true); |
@@ -2110,7 +2109,7 @@ TEST_F(URLRequestTestHTTP, CancelTest3) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
d.set_cancel_in_received_data(true); |
@@ -2135,7 +2134,7 @@ TEST_F(URLRequestTestHTTP, CancelTest4) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL(""), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -2162,7 +2161,7 @@ TEST_F(URLRequestTestHTTP, CancelTest5) { |
{ |
TestDelegate d; |
URLRequest r(test_server_.GetURL("cachetime"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
MessageLoop::current()->Run(); |
EXPECT_EQ(URLRequestStatus::SUCCESS, r.status().status()); |
@@ -2172,7 +2171,7 @@ TEST_F(URLRequestTestHTTP, CancelTest5) { |
{ |
TestDelegate d; |
URLRequest r(test_server_.GetURL("cachetime"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
r.Cancel(); |
MessageLoop::current()->Run(); |
@@ -2200,7 +2199,7 @@ TEST_F(URLRequestTestHTTP, PostEmptyTest) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL("echo"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.set_method("POST"); |
r.Start(); |
@@ -2222,7 +2221,7 @@ TEST_F(URLRequestTestHTTP, PostFileTest) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL("echo"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.set_method("POST"); |
FilePath dir; |
@@ -2276,7 +2275,7 @@ TEST_F(URLRequestTestHTTP, TestPostChunkedDataBeforeStart) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL("echo"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.EnableChunkedUpload(); |
r.set_method("POST"); |
AddChunksToUpload(&r); |
@@ -2295,7 +2294,7 @@ TEST_F(URLRequestTestHTTP, TestPostChunkedDataAfterStart) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL("echo"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.EnableChunkedUpload(); |
r.set_method("POST"); |
r.Start(); |
@@ -2313,7 +2312,7 @@ TEST_F(URLRequestTest, AboutBlankTest) { |
TestDelegate d; |
{ |
TestURLRequest r(GURL("about:blank"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -2353,7 +2352,7 @@ TEST_F(URLRequestTest, DataURLImageTest) { |
"moRWRNZr/F1KfVMjW+IKEnv2FwZfKdzt0BQR6lClcZR0EfEXEfv/G6W9iLiIyCoReV5En" |
"hORIBHx+ufPj/gLB/zGI/G4Bk0AAAAASUVORK5CYII="), |
&d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -2376,7 +2375,7 @@ TEST_F(URLRequestTest, FileTest) { |
TestDelegate d; |
{ |
TestURLRequest r(app_url, &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -2417,7 +2416,7 @@ TEST_F(URLRequestTest, FileTestFullSpecifiedRange) { |
TestDelegate d; |
{ |
TestURLRequest r(temp_url, &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kRange, |
@@ -2462,7 +2461,7 @@ TEST_F(URLRequestTest, FileTestHalfSpecifiedRange) { |
TestDelegate d; |
{ |
TestURLRequest r(temp_url, &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kRange, |
@@ -2500,7 +2499,7 @@ TEST_F(URLRequestTest, FileTestMultipleRanges) { |
TestDelegate d; |
{ |
TestURLRequest r(temp_url, &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kRange, |
@@ -2520,7 +2519,7 @@ TEST_F(URLRequestTest, InvalidUrlTest) { |
TestDelegate d; |
{ |
TestURLRequest r(GURL("invalid url"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -2535,7 +2534,7 @@ TEST_F(URLRequestTestHTTP, ResponseHeadersTest) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("files/with-headers.html"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2597,7 +2596,7 @@ TEST_F(URLRequestTest, ResolveShortcutTest) { |
TestDelegate d; |
{ |
TestURLRequest r(FilePathToFileURL(FilePath(lnk_path)), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -2636,7 +2635,7 @@ TEST_F(URLRequestTestHTTP, ContentTypeNormalizationTest) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL( |
"files/content-type-normalization.html"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2662,7 +2661,7 @@ TEST_F(URLRequestTest, FileDirCancelTest) { |
file_path = file_path.Append(FILE_PATH_LITERAL("data")); |
TestURLRequest req(FilePathToFileURL(file_path), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
EXPECT_TRUE(req.is_pending()); |
@@ -2688,7 +2687,7 @@ TEST_F(URLRequestTest, FileDirRedirectNoCrash) { |
TestDelegate d; |
TestURLRequest req(FilePathToFileURL(path), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2703,7 +2702,7 @@ TEST_F(URLRequestTest, FileDirRedirectNoCrash) { |
TEST_F(URLRequestTest, FileDirRedirectSingleSlash) { |
TestDelegate d; |
TestURLRequest req(GURL("file:///"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2718,7 +2717,7 @@ TEST_F(URLRequestTestHTTP, RestrictRedirects) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL( |
"files/redirect-to-file.html"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2732,7 +2731,7 @@ TEST_F(URLRequestTestHTTP, RedirectToInvalidURL) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL( |
"files/redirect-to-invalid-url.html"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2745,7 +2744,7 @@ TEST_F(URLRequestTestHTTP, NoUserPassInReferrer) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?Referer"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_referrer("http://user:pass@foo.com/"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2760,7 +2759,7 @@ TEST_F(URLRequestTestHTTP, CancelRedirect) { |
{ |
d.set_cancel_in_received_redirect(true); |
TestURLRequest req(test_server_.GetURL("files/redirect-test.html"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2778,7 +2777,7 @@ TEST_F(URLRequestTestHTTP, DeferredRedirect) { |
{ |
d.set_quit_on_redirect(true); |
TestURLRequest req(test_server_.GetURL("files/redirect-test.html"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2811,7 +2810,7 @@ TEST_F(URLRequestTestHTTP, CancelDeferredRedirect) { |
{ |
d.set_quit_on_redirect(true); |
TestURLRequest req(test_server_.GetURL("files/redirect-test.html"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2834,7 +2833,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { |
{ |
TestDelegate d; |
URLRequest req(test_server_.GetURL("echoheadercache?foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader("foo", "1"); |
req.SetExtraRequestHeaders(headers); |
@@ -2846,7 +2845,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { |
{ |
TestDelegate d; |
URLRequest req(test_server_.GetURL("echoheadercache?foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader("foo", "1"); |
req.SetExtraRequestHeaders(headers); |
@@ -2860,7 +2859,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { |
{ |
TestDelegate d; |
URLRequest req(test_server_.GetURL("echoheadercache?foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader("foo", "2"); |
req.SetExtraRequestHeaders(headers); |
@@ -2880,7 +2879,7 @@ TEST_F(URLRequestTestHTTP, BasicAuth) { |
d.set_credentials(AuthCredentials(kUser, kSecret)); |
URLRequest r(test_server_.GetURL("auth-basic"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -2896,7 +2895,7 @@ TEST_F(URLRequestTestHTTP, BasicAuth) { |
d.set_credentials(AuthCredentials(kUser, kSecret)); |
URLRequest r(test_server_.GetURL("auth-basic"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.set_load_flags(LOAD_VALIDATE_CACHE); |
r.Start(); |
@@ -2921,16 +2920,15 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { |
// Verify that when the transaction is restarted, it includes the new cookie. |
{ |
TestNetworkDelegate network_delegate; // must outlive URLRequest |
- scoped_refptr<TestURLRequestContext> context( |
- new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
TestDelegate d; |
d.set_credentials(AuthCredentials(kUser, kSecret)); |
URLRequest r(url_requiring_auth, &d); |
- r.set_context(context); |
+ r.set_context(&context); |
r.Start(); |
MessageLoop::current()->Run(); |
@@ -2947,19 +2945,19 @@ TEST_F(URLRequestTest, DelayedCookieCallback) { |
LocalHttpTestServer test_server; |
ASSERT_TRUE(test_server.Start()); |
- scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); |
+ TestURLRequestContext context; |
scoped_refptr<DelayedCookieMonster> delayed_cm = |
new DelayedCookieMonster(); |
scoped_refptr<CookieStore> cookie_store = delayed_cm; |
- context->set_cookie_store(delayed_cm); |
+ context.set_cookie_store(delayed_cm); |
// Set up a cookie. |
{ |
TestNetworkDelegate network_delegate; |
- context->set_network_delegate(&network_delegate); |
+ context.set_network_delegate(&network_delegate); |
TestDelegate d; |
URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); |
- req.set_context(context); |
+ req.set_context(&context); |
req.Start(); |
MessageLoop::current()->Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
@@ -2970,10 +2968,10 @@ TEST_F(URLRequestTest, DelayedCookieCallback) { |
// Verify that the cookie is set. |
{ |
TestNetworkDelegate network_delegate; |
- context->set_network_delegate(&network_delegate); |
+ context.set_network_delegate(&network_delegate); |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
- req.set_context(context); |
+ req.set_context(&context); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -2991,10 +2989,10 @@ TEST_F(URLRequestTest, DoNotSendCookies) { |
// Set up a cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
@@ -3004,10 +3002,10 @@ TEST_F(URLRequestTest, DoNotSendCookies) { |
// Verify that the cookie is set. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3020,11 +3018,11 @@ TEST_F(URLRequestTest, DoNotSendCookies) { |
// Verify that the cookie isn't sent when LOAD_DO_NOT_SEND_COOKIES is set. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
req.set_load_flags(LOAD_DO_NOT_SEND_COOKIES); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3036,7 +3034,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) { |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
} |
- default_context_->set_network_delegate(&default_network_delegate_); |
+ default_context_.set_network_delegate(&default_network_delegate_); |
} |
TEST_F(URLRequestTest, DoNotSaveCookies) { |
@@ -3046,10 +3044,10 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { |
// Set up a cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3061,12 +3059,12 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { |
// Try to set-up another cookie and update the previous cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
URLRequest req(test_server.GetURL( |
"set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d); |
req.set_load_flags(LOAD_DO_NOT_SAVE_COOKIES); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3080,10 +3078,10 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { |
// Verify the cookies weren't saved or updated. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3097,7 +3095,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { |
EXPECT_EQ(0, network_delegate.set_cookie_count()); |
} |
- default_context_->set_network_delegate(&default_network_delegate_); |
+ default_context_.set_network_delegate(&default_network_delegate_); |
} |
TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
@@ -3107,10 +3105,10 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
// Set up a cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3121,10 +3119,10 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
// Verify that the cookie is set. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3138,11 +3136,11 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
// Verify that the cookie isn't sent. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
network_delegate.set_cookie_options(TestNetworkDelegate::NO_GET_COOKIES); |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3153,7 +3151,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
} |
- default_context_->set_network_delegate(&default_network_delegate_); |
+ default_context_.set_network_delegate(&default_network_delegate_); |
} |
TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { |
@@ -3163,10 +3161,10 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { |
// Set up a cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3177,12 +3175,12 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { |
// Try to set-up another cookie and update the previous cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
network_delegate.set_cookie_options(TestNetworkDelegate::NO_SET_COOKIE); |
URLRequest req(test_server.GetURL( |
"set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3195,10 +3193,10 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { |
// Verify the cookies weren't saved or updated. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3211,7 +3209,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
} |
- default_context_->set_network_delegate(&default_network_delegate_); |
+ default_context_.set_network_delegate(&default_network_delegate_); |
} |
TEST_F(URLRequestTest, DoNotSaveEmptyCookies) { |
@@ -3221,10 +3219,10 @@ TEST_F(URLRequestTest, DoNotSaveEmptyCookies) { |
// Set up an empty cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
URLRequest req(test_server.GetURL("set-cookie"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3233,7 +3231,7 @@ TEST_F(URLRequestTest, DoNotSaveEmptyCookies) { |
EXPECT_EQ(0, network_delegate.set_cookie_count()); |
} |
- default_context_->set_network_delegate(&default_network_delegate_); |
+ default_context_.set_network_delegate(&default_network_delegate_); |
} |
TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
@@ -3243,10 +3241,10 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
// Set up a cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
URLRequest req(test_server.GetURL("set-cookie?CookieToNotSend=1"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3257,10 +3255,10 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
// Verify that the cookie is set. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3274,11 +3272,11 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
// Verify that the cookie isn't sent. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
network_delegate.set_cookie_options(TestNetworkDelegate::NO_GET_COOKIES); |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3289,7 +3287,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
} |
- default_context_->set_network_delegate(&default_network_delegate_); |
+ default_context_.set_network_delegate(&default_network_delegate_); |
} |
TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { |
@@ -3299,10 +3297,10 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { |
// Set up a cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
URLRequest req(test_server.GetURL("set-cookie?CookieToNotUpdate=2"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3313,12 +3311,12 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { |
// Try to set-up another cookie and update the previous cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
network_delegate.set_cookie_options(TestNetworkDelegate::NO_SET_COOKIE); |
URLRequest req(test_server.GetURL( |
"set-cookie?CookieToNotSave=1&CookieToNotUpdate=1"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3330,10 +3328,10 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { |
// Verify the cookies weren't saved or updated. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Cookie"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3346,7 +3344,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
} |
- default_context_->set_network_delegate(&default_network_delegate_); |
+ default_context_.set_network_delegate(&default_network_delegate_); |
} |
void CheckCookiePolicyCallback(bool* was_run, const CookieList& cookies) { |
@@ -3363,12 +3361,12 @@ TEST_F(URLRequestTest, CookiePolicy_ForceSession) { |
// Set up a cookie. |
{ |
TestNetworkDelegate network_delegate; |
- default_context_->set_network_delegate(&network_delegate); |
+ default_context_.set_network_delegate(&network_delegate); |
TestDelegate d; |
network_delegate.set_cookie_options(TestNetworkDelegate::FORCE_SESSION); |
URLRequest req(test_server.GetURL( |
"set-cookie?A=1;expires=\"Fri, 05 Feb 2010 23:42:01 GMT\""), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); // Triggers an asynchronous cookie policy check. |
MessageLoop::current()->Run(); |
@@ -3376,11 +3374,11 @@ TEST_F(URLRequestTest, CookiePolicy_ForceSession) { |
EXPECT_EQ(0, network_delegate.blocked_get_cookies_count()); |
EXPECT_EQ(0, network_delegate.blocked_set_cookie_count()); |
} |
- default_context_->set_network_delegate(&default_network_delegate_); |
+ default_context_.set_network_delegate(&default_network_delegate_); |
// Now, check the cookie store. |
bool was_run = false; |
- default_context_->cookie_store()->GetCookieMonster()->GetAllCookiesAsync( |
+ default_context_.cookie_store()->GetCookieMonster()->GetAllCookiesAsync( |
base::Bind(&CheckCookiePolicyCallback, &was_run)); |
MessageLoop::current()->RunAllPending(); |
DCHECK(was_run); |
@@ -3397,7 +3395,7 @@ TEST_F(URLRequestTestHTTP, Post302RedirectGet) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("files/redirect-to-echoall"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("POST"); |
req.set_upload(CreateSimpleUploadData(kData)); |
@@ -3484,7 +3482,7 @@ TEST_F(URLRequestTestHTTP, InterceptPost302RedirectGet) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("empty.html"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("POST"); |
req.set_upload(CreateSimpleUploadData(kData).get()); |
HttpRequestHeaders headers; |
@@ -3508,7 +3506,7 @@ TEST_F(URLRequestTestHTTP, InterceptPost307RedirectPost) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("empty.html"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("POST"); |
req.set_upload(CreateSimpleUploadData(kData).get()); |
HttpRequestHeaders headers; |
@@ -3728,7 +3726,7 @@ TEST_F(URLRequestTest, Intercept) { |
TestDelegate d; |
TestURLRequest req(GURL("http://test_intercept/foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
base::SupportsUserData::Data* user_data0 = new base::SupportsUserData::Data(); |
base::SupportsUserData::Data* user_data1 = new base::SupportsUserData::Data(); |
base::SupportsUserData::Data* user_data2 = new base::SupportsUserData::Data(); |
@@ -3770,7 +3768,7 @@ TEST_F(URLRequestTest, InterceptRedirect) { |
TestDelegate d; |
TestURLRequest req(GURL("http://test_intercept/foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("GET"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3804,7 +3802,7 @@ TEST_F(URLRequestTest, InterceptServerError) { |
TestDelegate d; |
TestURLRequest req(GURL("http://test_intercept/foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("GET"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3834,7 +3832,7 @@ TEST_F(URLRequestTest, InterceptNetworkError) { |
TestDelegate d; |
TestURLRequest req(GURL("http://test_intercept/foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("GET"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3864,7 +3862,7 @@ TEST_F(URLRequestTest, InterceptRestartRequired) { |
TestDelegate d; |
TestURLRequest req(GURL("http://test_intercept/foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("GET"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3896,7 +3894,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelMain) { |
TestDelegate d; |
TestURLRequest req(GURL("http://test_intercept/foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("GET"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3928,7 +3926,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelRedirect) { |
TestDelegate d; |
TestURLRequest req(GURL("http://test_intercept/foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("GET"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3954,7 +3952,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelFinal) { |
TestDelegate d; |
TestURLRequest req(GURL("http://test_intercept/foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("GET"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -3981,7 +3979,7 @@ TEST_F(URLRequestTest, InterceptRespectsCancelInRestart) { |
TestDelegate d; |
TestURLRequest req(GURL("http://test_intercept/foo"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.set_method("GET"); |
req.Start(); |
MessageLoop::current()->Run(); |
@@ -4011,15 +4009,15 @@ TEST_F(URLRequestTest, NetworkDelegateProxyError) { |
host_resolver.rules()->AddSimulatedFailure("*"); |
TestNetworkDelegate network_delegate; // must outlive URLRequests |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->SetProxyFromString("myproxy:70"); |
- context->set_host_resolver(&host_resolver); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.SetProxyFromString("myproxy:70"); |
+ context.set_host_resolver(&host_resolver); |
+ context.Init(); |
TestDelegate d; |
TestURLRequest req(GURL("http://example.com"), &d); |
- req.set_context(context); |
+ req.set_context(&context); |
req.set_method("GET"); |
req.Start(); |
@@ -4047,7 +4045,7 @@ TEST_F(URLRequestTest, DoNotOverrideReferrer) { |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Referer"), &d); |
req.set_referrer("http://foo.com/"); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kReferer, "http://bar.com/"); |
@@ -4064,7 +4062,7 @@ TEST_F(URLRequestTest, DoNotOverrideReferrer) { |
{ |
TestDelegate d; |
TestURLRequest req(test_server.GetURL("echoheader?Referer"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kReferer, "http://bar.com/"); |
@@ -4084,7 +4082,7 @@ TEST_F(URLRequestTest, RequestCompletionForEmptyResponse) { |
TestDelegate d; |
TestURLRequest req(GURL("data:,"), &d); |
req.set_context(new TestURLRequestContext()); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
EXPECT_EQ("", d.data_received()); |
@@ -4108,7 +4106,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPDirectoryListing) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL("/"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4135,7 +4133,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPGetTestAnonymous) { |
TestDelegate d; |
{ |
TestURLRequest r(test_server_.GetURL("/LICENSE"), &d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4167,7 +4165,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPGetTest) { |
TestURLRequest r( |
test_server_.GetURLWithUserAndPassword("/LICENSE", "chrome", "chrome"), |
&d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4201,7 +4199,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongPassword) { |
"chrome", |
"wrong_password"), |
&d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4234,7 +4232,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongPasswordRestart) { |
"chrome", |
"wrong_password"), |
&d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4264,7 +4262,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUser) { |
"wrong_user", |
"chrome"), |
&d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4297,7 +4295,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCheckWrongUserRestart) { |
"wrong_user", |
"chrome"), |
&d); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4329,7 +4327,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheURLCredentials) { |
"chrome", |
"chrome"), |
d.get()); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4348,7 +4346,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheURLCredentials) { |
{ |
// This request should use cached identity from previous request. |
TestURLRequest r(test_server_.GetURL("/LICENSE"), d.get()); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4382,7 +4380,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheLoginBoxCredentials) { |
"chrome", |
"wrong_password"), |
d.get()); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4404,7 +4402,7 @@ TEST_F(URLRequestTestFTP, DISABLED_FTPCacheLoginBoxCredentials) { |
// Don't pass wrong credentials in the URL, they would override valid cached |
// ones. |
TestURLRequest r(test_server_.GetURL("/LICENSE"), d.get()); |
- r.set_context(default_context_); |
+ r.set_context(&default_context_); |
r.Start(); |
EXPECT_TRUE(r.is_pending()); |
@@ -4425,14 +4423,14 @@ TEST_F(URLRequestTestHTTP, DefaultAcceptLanguage) { |
ASSERT_TRUE(test_server_.Start()); |
TestNetworkDelegate network_delegate; // must outlive URLRequests |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->set_accept_language("en"); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.set_accept_language("en"); |
+ context.Init(); |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?Accept-Language"), &d); |
- req.set_context(context); |
+ req.set_context(&context); |
req.Start(); |
MessageLoop::current()->Run(); |
EXPECT_EQ("en", d.data_received()); |
@@ -4443,16 +4441,16 @@ TEST_F(URLRequestTestHTTP, EmptyAcceptLanguage) { |
ASSERT_TRUE(test_server_.Start()); |
TestNetworkDelegate network_delegate; // must outlive URLRequests |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
// We override the language after initialization because empty entries |
// get overridden by Init(). |
- context->set_accept_language(""); |
+ context.set_accept_language(""); |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?Accept-Language"), &d); |
- req.set_context(context); |
+ req.set_context(&context); |
req.Start(); |
MessageLoop::current()->Run(); |
EXPECT_EQ("None", d.data_received()); |
@@ -4465,7 +4463,7 @@ TEST_F(URLRequestTestHTTP, OverrideAcceptLanguage) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?Accept-Language"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kAcceptLanguage, "ru"); |
req.SetExtraRequestHeaders(headers); |
@@ -4480,7 +4478,7 @@ TEST_F(URLRequestTestHTTP, DefaultAcceptEncoding) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?Accept-Encoding"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
req.SetExtraRequestHeaders(headers); |
req.Start(); |
@@ -4495,7 +4493,7 @@ TEST_F(URLRequestTestHTTP, OverrideAcceptEncoding) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?Accept-Encoding"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kAcceptEncoding, "identity"); |
req.SetExtraRequestHeaders(headers); |
@@ -4510,14 +4508,14 @@ TEST_F(URLRequestTestHTTP, DefaultAcceptCharset) { |
ASSERT_TRUE(test_server_.Start()); |
TestNetworkDelegate network_delegate; // must outlive URLRequests |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->set_accept_charset("en"); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.set_accept_charset("en"); |
+ context.Init(); |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?Accept-Charset"), &d); |
- req.set_context(context); |
+ req.set_context(&context); |
req.Start(); |
MessageLoop::current()->Run(); |
EXPECT_EQ("en", d.data_received()); |
@@ -4528,16 +4526,16 @@ TEST_F(URLRequestTestHTTP, EmptyAcceptCharset) { |
ASSERT_TRUE(test_server_.Start()); |
TestNetworkDelegate network_delegate; // must outlive URLRequests |
- scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext(true)); |
- context->set_network_delegate(&network_delegate); |
- context->Init(); |
+ TestURLRequestContext context(true); |
+ context.set_network_delegate(&network_delegate); |
+ context.Init(); |
// We override the accepted charset after initialization because empty |
// entries get overridden otherwise. |
- context->set_accept_charset(""); |
+ context.set_accept_charset(""); |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?Accept-Charset"), &d); |
- req.set_context(context); |
+ req.set_context(&context); |
req.Start(); |
MessageLoop::current()->Run(); |
EXPECT_EQ("None", d.data_received()); |
@@ -4550,7 +4548,7 @@ TEST_F(URLRequestTestHTTP, OverrideAcceptCharset) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?Accept-Charset"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kAcceptCharset, "koi-8r"); |
req.SetExtraRequestHeaders(headers); |
@@ -4565,7 +4563,7 @@ TEST_F(URLRequestTestHTTP, DefaultUserAgent) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?User-Agent"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
req.Start(); |
MessageLoop::current()->Run(); |
EXPECT_EQ(req.context()->GetUserAgent(req.url()), d.data_received()); |
@@ -4578,7 +4576,7 @@ TEST_F(URLRequestTestHTTP, OverrideUserAgent) { |
TestDelegate d; |
TestURLRequest req(test_server_.GetURL("echoheader?User-Agent"), &d); |
- req.set_context(default_context_); |
+ req.set_context(&default_context_); |
HttpRequestHeaders headers; |
headers.SetHeader(HttpRequestHeaders::kUserAgent, "Lynx (textmode)"); |
req.SetExtraRequestHeaders(headers); |