Index: net/socket_stream/socket_stream_unittest.cc |
=================================================================== |
--- net/socket_stream/socket_stream_unittest.cc (revision 256594) |
+++ net/socket_stream/socket_stream_unittest.cc (working copy) |
@@ -318,7 +318,7 @@ |
virtual void DoCloseFlushPendingWriteTestWithSetContextNull( |
SocketStreamEvent* event) { |
- event->socket->set_context(NULL); |
+ event->socket->DetachContext(); |
// handshake response received. |
for (size_t i = 0; i < messages_.size(); i++) { |
std::vector<char> frame; |
@@ -400,10 +400,9 @@ |
TestURLRequestContext context; |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
- socket_stream->set_context(&context); |
- |
MockWrite data_writes[] = { |
MockWrite(SocketStreamTest::kWebSocketHandshakeRequest), |
MockWrite(ASYNC, "\0message1\xff", 10), |
@@ -453,17 +452,17 @@ |
scoped_ptr<SocketStreamEventRecorder> delegate( |
new SocketStreamEventRecorder(test_callback.callback())); |
- scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
- |
// Make resolver fail. |
TestURLRequestContext context; |
scoped_ptr<MockHostResolver> mock_host_resolver( |
new MockHostResolver()); |
mock_host_resolver->rules()->AddSimulatedFailure("example.com"); |
context.set_host_resolver(mock_host_resolver.get()); |
- socket_stream->set_context(&context); |
+ scoped_refptr<SocketStream> socket_stream( |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
+ |
// No read/write on socket is expected. |
StaticSocketDataProvider data_provider(NULL, 0, NULL, 0); |
MockClientSocketFactory* mock_socket_factory = |
@@ -493,10 +492,9 @@ |
TestURLRequestContext context; |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
- socket_stream->set_context(&context); |
- |
DelayedSocketData data_provider(1, NULL, 0, NULL, 0); |
MockClientSocketFactory* mock_socket_factory = |
@@ -566,12 +564,12 @@ |
&SocketStreamEventRecorder::DoRestartWithAuth, |
base::Unretained(delegate.get()))); |
- scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
- |
TestURLRequestContextWithProxy context("myproxy:70"); |
- socket_stream->set_context(&context); |
+ scoped_refptr<SocketStream> socket_stream( |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
+ |
socket_stream->SetClientSocketFactory(&mock_socket_factory); |
socket_stream->Connect(); |
@@ -618,9 +616,6 @@ |
delegate->SetOnConnected(base::Bind(&SocketStreamEventRecorder::DoClose, |
base::Unretained(delegate.get()))); |
- scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
- |
TestURLRequestContextWithProxy context("myproxy:70"); |
HttpAuthCache* auth_cache = |
context.http_transaction_factory()->GetSession()->http_auth_cache(); |
@@ -632,7 +627,10 @@ |
ASCIIToUTF16("bar")), |
"/"); |
- socket_stream->set_context(&context); |
+ scoped_refptr<SocketStream> socket_stream( |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
+ |
socket_stream->SetClientSocketFactory(&mock_socket_factory); |
socket_stream->Connect(); |
@@ -675,9 +673,6 @@ |
delegate->SetOnConnected(base::Bind(&SocketStreamEventRecorder::DoClose, |
base::Unretained(delegate.get()))); |
- scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("wss://example.com/demo"), delegate.get())); |
- |
TestURLRequestContextWithProxy context("myproxy:70"); |
HttpAuthCache* auth_cache = |
context.http_transaction_factory()->GetSession()->http_auth_cache(); |
@@ -689,7 +684,10 @@ |
ASCIIToUTF16("bar")), |
"/"); |
- socket_stream->set_context(&context); |
+ scoped_refptr<SocketStream> socket_stream( |
+ new SocketStream(GURL("wss://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
+ |
socket_stream->SetClientSocketFactory(&mock_socket_factory); |
socket_stream->Connect(); |
@@ -721,10 +719,9 @@ |
TestURLRequestContext context; |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
- socket_stream->set_context(&context); |
- |
MockWrite data_writes[] = { |
MockWrite(SocketStreamTest::kWebSocketHandshakeRequest), |
MockWrite(ASYNC, "\0message1\xff", 10), |
@@ -783,10 +780,9 @@ |
TestURLRequestContext context; |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
- socket_stream->set_context(&context); |
- |
socket_stream->Connect(); |
EXPECT_EQ(ERR_PROTOCOL_SWITCHED, test_callback.WaitForResult()); |
@@ -811,10 +807,9 @@ |
TestURLRequestContext context; |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
- socket_stream->set_context(&context); |
- |
socket_stream->Connect(); |
io_test_callback_.WaitForResult(); |
@@ -865,9 +860,9 @@ |
base::Unretained(delegate.get()))); |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
- socket_stream->set_context(&context); |
socket_stream->SetClientSocketFactory(&mock_socket_factory); |
socket_stream->Connect(); |
@@ -916,9 +911,9 @@ |
base::Unretained(delegate.get()))); |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
- socket_stream->set_context(&context); |
socket_stream->SetClientSocketFactory(&mock_socket_factory); |
socket_stream->Connect(); |
@@ -948,10 +943,9 @@ |
context.set_network_delegate(&network_delegate); |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
- socket_stream->set_context(&context); |
- |
socket_stream->Connect(); |
test_callback.WaitForResult(); |
@@ -981,8 +975,8 @@ |
TestURLRequestContext context; |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://localhost:9998/echo"), delegate)); |
- socket_stream->set_context(&context); |
+ new SocketStream(GURL("ws://localhost:9998/echo"), delegate, |
+ &context, NULL)); |
socket_stream->SetClientSocketFactory(&mock_socket_factory); |
delegate->set_socket_stream(socket_stream); |
// The delegate pointer will become invalid during the test. Set it to NULL to |
@@ -1001,7 +995,8 @@ |
new SocketStreamEventRecorder(test_callback.callback())); |
TestURLRequestContext context; |
scoped_refptr<SocketStream> socket_stream( |
- new SocketStream(GURL("ws://example.com/demo"), delegate.get())); |
+ new SocketStream(GURL("ws://example.com/demo"), delegate.get(), |
+ &context, NULL)); |
delegate->SetOnStartOpenConnection(base::Bind( |
&SocketStreamTest::DoIOPending, base::Unretained(this))); |
delegate->SetOnConnected(base::Bind( |
@@ -1010,8 +1005,6 @@ |
&SocketStreamTest::DoCloseFlushPendingWriteTestWithSetContextNull, |
base::Unretained(this))); |
- socket_stream->set_context(&context); |
- |
MockWrite data_writes[] = { |
MockWrite(SocketStreamTest::kWebSocketHandshakeRequest), |
}; |