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

Unified Diff: net/socket_stream/socket_stream_unittest.cc

Issue 10299002: Stop refcounting URLRequestContext. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initialize to NULL Created 8 years, 7 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/socket_stream/socket_stream_job.h ('k') | net/spdy/spdy_network_transaction_spdy2_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket_stream/socket_stream_unittest.cc
diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc
index 25fc0a83e16e5cddcb58b335625f824e5fb7da25..a7a0cc73b4c9108759820b92dfabe62c80626dd5 100644
--- a/net/socket_stream/socket_stream_unittest.cc
+++ b/net/socket_stream/socket_stream_unittest.cc
@@ -279,11 +279,12 @@ TEST_F(SocketStreamTest, CloseFlushPendingWrite) {
base::Unretained(this)));
MockHostResolver host_resolver;
+ TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
- socket_stream->set_context(new TestURLRequestContext());
+ socket_stream->set_context(&context);
socket_stream->SetHostResolver(&host_resolver);
MockWrite data_writes[] = {
@@ -379,8 +380,10 @@ TEST_F(SocketStreamTest, BasicAuthProxy) {
scoped_refptr<SocketStream> socket_stream(
new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
- socket_stream->set_context(new TestURLRequestContext("myproxy:70"));
MockHostResolver host_resolver;
+ TestURLRequestContext context("myproxy:70");
+
+ socket_stream->set_context(&context);
socket_stream->SetHostResolver(&host_resolver);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
@@ -416,11 +419,12 @@ TEST_F(SocketStreamTest, IOPending) {
&SocketStreamTest::DoIOPending, base::Unretained(this)));
MockHostResolver host_resolver;
+ TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
- socket_stream->set_context(new TestURLRequestContext());
+ socket_stream->set_context(&context);
socket_stream->SetHostResolver(&host_resolver);
MockWrite data_writes[] = {
@@ -479,11 +483,12 @@ TEST_F(SocketStreamTest, SwitchToSpdy) {
&SocketStreamTest::DoSwitchToSpdyTest, base::Unretained(this)));
MockHostResolver host_resolver;
+ TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
- socket_stream->set_context(new TestURLRequestContext());
+ socket_stream->set_context(&context);
socket_stream->SetHostResolver(&host_resolver);
socket_stream->Connect();
@@ -508,11 +513,12 @@ TEST_F(SocketStreamTest, SwitchAfterPending) {
&SocketStreamTest::DoIOPending, base::Unretained(this)));
MockHostResolver host_resolver;
+ TestURLRequestContext context;
scoped_refptr<SocketStream> socket_stream(
new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
- socket_stream->set_context(new TestURLRequestContext());
+ socket_stream->set_context(&context);
socket_stream->SetHostResolver(&host_resolver);
socket_stream->Connect();
@@ -556,6 +562,8 @@ TEST_F(SocketStreamTest, SecureProxyConnectError) {
mock_socket_factory.AddSSLSocketDataProvider(&ssl);
TestCompletionCallback test_callback;
+ MockHostResolver host_resolver;
+ TestURLRequestContext context("https://myproxy:70");
scoped_ptr<SocketStreamEventRecorder> delegate(
new SocketStreamEventRecorder(test_callback.callback()));
@@ -565,8 +573,7 @@ TEST_F(SocketStreamTest, SecureProxyConnectError) {
scoped_refptr<SocketStream> socket_stream(
new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
- socket_stream->set_context(new TestURLRequestContext("https://myproxy:70"));
- MockHostResolver host_resolver;
+ socket_stream->set_context(&context);
socket_stream->SetHostResolver(&host_resolver);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
@@ -608,6 +615,8 @@ TEST_F(SocketStreamTest, SecureProxyConnect) {
mock_socket_factory.AddSSLSocketDataProvider(&ssl);
TestCompletionCallback test_callback;
+ MockHostResolver host_resolver;
+ TestURLRequestContext context("https://myproxy:70");
scoped_ptr<SocketStreamEventRecorder> delegate(
new SocketStreamEventRecorder(test_callback.callback()));
@@ -617,8 +626,7 @@ TEST_F(SocketStreamTest, SecureProxyConnect) {
scoped_refptr<SocketStream> socket_stream(
new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
- socket_stream->set_context(new TestURLRequestContext("https://myproxy:70"));
- MockHostResolver host_resolver;
+ socket_stream->set_context(&context);
socket_stream->SetHostResolver(&host_resolver);
socket_stream->SetClientSocketFactory(&mock_socket_factory);
« no previous file with comments | « net/socket_stream/socket_stream_job.h ('k') | net/spdy/spdy_network_transaction_spdy2_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698