| Index: trunk/src/net/socket_stream/socket_stream_unittest.cc
|
| ===================================================================
|
| --- trunk/src/net/socket_stream/socket_stream_unittest.cc (revision 256581)
|
| +++ trunk/src/net/socket_stream/socket_stream_unittest.cc (working copy)
|
| @@ -318,7 +318,7 @@
|
|
|
| virtual void DoCloseFlushPendingWriteTestWithSetContextNull(
|
| SocketStreamEvent* event) {
|
| - event->socket->DetachContext();
|
| + event->socket->set_context(NULL);
|
| // handshake response received.
|
| for (size_t i = 0; i < messages_.size(); i++) {
|
| std::vector<char> frame;
|
| @@ -400,9 +400,10 @@
|
| TestURLRequestContext context;
|
|
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
|
|
|
| + socket_stream->set_context(&context);
|
| +
|
| MockWrite data_writes[] = {
|
| MockWrite(SocketStreamTest::kWebSocketHandshakeRequest),
|
| MockWrite(ASYNC, "\0message1\xff", 10),
|
| @@ -452,17 +453,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 =
|
| @@ -492,9 +493,10 @@
|
| TestURLRequestContext context;
|
|
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
|
|
|
| + socket_stream->set_context(&context);
|
| +
|
| DelayedSocketData data_provider(1, NULL, 0, NULL, 0);
|
|
|
| MockClientSocketFactory* mock_socket_factory =
|
| @@ -564,12 +566,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");
|
|
|
| - scoped_refptr<SocketStream> socket_stream(
|
| - 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();
|
| @@ -616,6 +618,9 @@
|
| 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();
|
| @@ -627,10 +632,7 @@
|
| ASCIIToUTF16("bar")),
|
| "/");
|
|
|
| - scoped_refptr<SocketStream> socket_stream(
|
| - 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();
|
| @@ -673,6 +675,9 @@
|
| 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();
|
| @@ -684,10 +689,7 @@
|
| ASCIIToUTF16("bar")),
|
| "/");
|
|
|
| - scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("wss://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| -
|
| + socket_stream->set_context(&context);
|
| socket_stream->SetClientSocketFactory(&mock_socket_factory);
|
|
|
| socket_stream->Connect();
|
| @@ -719,9 +721,10 @@
|
| TestURLRequestContext context;
|
|
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
|
|
|
| + socket_stream->set_context(&context);
|
| +
|
| MockWrite data_writes[] = {
|
| MockWrite(SocketStreamTest::kWebSocketHandshakeRequest),
|
| MockWrite(ASYNC, "\0message1\xff", 10),
|
| @@ -780,9 +783,10 @@
|
| TestURLRequestContext context;
|
|
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
|
|
|
| + socket_stream->set_context(&context);
|
| +
|
| socket_stream->Connect();
|
|
|
| EXPECT_EQ(ERR_PROTOCOL_SWITCHED, test_callback.WaitForResult());
|
| @@ -807,9 +811,10 @@
|
| TestURLRequestContext context;
|
|
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
|
|
|
| + socket_stream->set_context(&context);
|
| +
|
| socket_stream->Connect();
|
| io_test_callback_.WaitForResult();
|
|
|
| @@ -860,9 +865,9 @@
|
| base::Unretained(delegate.get())));
|
|
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
|
|
|
| + socket_stream->set_context(&context);
|
| socket_stream->SetClientSocketFactory(&mock_socket_factory);
|
|
|
| socket_stream->Connect();
|
| @@ -911,9 +916,9 @@
|
| base::Unretained(delegate.get())));
|
|
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
|
|
|
| + socket_stream->set_context(&context);
|
| socket_stream->SetClientSocketFactory(&mock_socket_factory);
|
|
|
| socket_stream->Connect();
|
| @@ -943,9 +948,10 @@
|
| context.set_network_delegate(&network_delegate);
|
|
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
|
|
|
| + socket_stream->set_context(&context);
|
| +
|
| socket_stream->Connect();
|
|
|
| test_callback.WaitForResult();
|
| @@ -975,8 +981,8 @@
|
|
|
| TestURLRequestContext context;
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://localhost:9998/echo"), delegate,
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://localhost:9998/echo"), delegate));
|
| + socket_stream->set_context(&context);
|
| 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
|
| @@ -995,8 +1001,7 @@
|
| new SocketStreamEventRecorder(test_callback.callback()));
|
| TestURLRequestContext context;
|
| scoped_refptr<SocketStream> socket_stream(
|
| - new SocketStream(GURL("ws://example.com/demo"), delegate.get(),
|
| - &context, NULL));
|
| + new SocketStream(GURL("ws://example.com/demo"), delegate.get()));
|
| delegate->SetOnStartOpenConnection(base::Bind(
|
| &SocketStreamTest::DoIOPending, base::Unretained(this)));
|
| delegate->SetOnConnected(base::Bind(
|
| @@ -1005,6 +1010,8 @@
|
| &SocketStreamTest::DoCloseFlushPendingWriteTestWithSetContextNull,
|
| base::Unretained(this)));
|
|
|
| + socket_stream->set_context(&context);
|
| +
|
| MockWrite data_writes[] = {
|
| MockWrite(SocketStreamTest::kWebSocketHandshakeRequest),
|
| };
|
|
|