Index: remoting/protocol/channel_multiplexer_unittest.cc |
diff --git a/remoting/protocol/channel_multiplexer_unittest.cc b/remoting/protocol/channel_multiplexer_unittest.cc |
index 11a459be1daa19dfac3442fbc7a2728470aa7e37..c4c8179042c8e5dc43e9fbf396936e5074e06f78 100644 |
--- a/remoting/protocol/channel_multiplexer_unittest.cc |
+++ b/remoting/protocol/channel_multiplexer_unittest.cc |
@@ -56,6 +56,11 @@ class ChannelMultiplexerTest : public testing::Test { |
host_mux_.reset(new ChannelMultiplexer(&host_session_, kMuxChannelName)); |
client_mux_.reset(new ChannelMultiplexer(&client_session_, |
kMuxChannelName)); |
+ } |
+ |
+ // Connect sockets to each other. Must be called after we've created at least |
+ // one channel with each multiplexer. |
+ void ConnectSockets() { |
FakeSocket* host_socket = |
host_session_.GetStreamChannel(ChannelMultiplexer::kMuxChannelName); |
FakeSocket* client_socket = |
@@ -123,6 +128,8 @@ TEST_F(ChannelMultiplexerTest, OneChannel) { |
scoped_ptr<net::StreamSocket> client_socket; |
ASSERT_NO_FATAL_FAILURE(CreateChannel("test", &host_socket, &client_socket)); |
+ ConnectSockets(); |
+ |
StreamConnectionTester tester(host_socket.get(), client_socket.get(), |
kMessageSize, kMessages); |
tester.Start(); |
@@ -141,6 +148,8 @@ TEST_F(ChannelMultiplexerTest, TwoChannels) { |
ASSERT_NO_FATAL_FAILURE( |
CreateChannel("ch2", &host_socket2_, &client_socket2_)); |
+ ConnectSockets(); |
+ |
StreamConnectionTester tester1(host_socket1_.get(), client_socket1_.get(), |
kMessageSize, kMessages); |
StreamConnectionTester tester2(host_socket2_.get(), client_socket2_.get(), |
@@ -176,6 +185,8 @@ TEST_F(ChannelMultiplexerTest, FourChannels) { |
ASSERT_NO_FATAL_FAILURE( |
CreateChannel("ch4", &host_socket4, &client_socket4)); |
+ ConnectSockets(); |
+ |
StreamConnectionTester tester1(host_socket1_.get(), client_socket1_.get(), |
kMessageSize, kMessages); |
StreamConnectionTester tester2(host_socket2_.get(), client_socket2_.get(), |
@@ -209,6 +220,8 @@ TEST_F(ChannelMultiplexerTest, SyncFail) { |
ASSERT_NO_FATAL_FAILURE( |
CreateChannel("ch2", &host_socket2_, &client_socket2_)); |
+ ConnectSockets(); |
+ |
host_session_.GetStreamChannel(kMuxChannelName)-> |
set_next_write_error(net::ERR_FAILED); |
host_session_.GetStreamChannel(kMuxChannelName)-> |
@@ -239,6 +252,8 @@ TEST_F(ChannelMultiplexerTest, AsyncFail) { |
ASSERT_NO_FATAL_FAILURE( |
CreateChannel("ch2", &host_socket2_, &client_socket2_)); |
+ ConnectSockets(); |
+ |
host_session_.GetStreamChannel(kMuxChannelName)-> |
set_next_write_error(net::ERR_FAILED); |
host_session_.GetStreamChannel(kMuxChannelName)-> |
@@ -267,6 +282,8 @@ TEST_F(ChannelMultiplexerTest, DeleteWhenFailed) { |
ASSERT_NO_FATAL_FAILURE( |
CreateChannel("ch2", &host_socket2_, &client_socket2_)); |
+ ConnectSockets(); |
+ |
host_session_.GetStreamChannel(kMuxChannelName)-> |
set_next_write_error(net::ERR_FAILED); |
host_session_.GetStreamChannel(kMuxChannelName)-> |