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

Unified Diff: remoting/protocol/channel_multiplexer_unittest.cc

Issue 10823323: Add support for multiplexed channels in remoting::protocol::Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « remoting/protocol/channel_multiplexer.cc ('k') | remoting/protocol/connection_to_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)->
« no previous file with comments | « remoting/protocol/channel_multiplexer.cc ('k') | remoting/protocol/connection_to_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698