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

Unified Diff: remoting/protocol/connection_to_client_unittest.cc

Issue 7218061: Close all writers before JingleSession is destroyed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 6 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
Index: remoting/protocol/connection_to_client_unittest.cc
diff --git a/remoting/protocol/connection_to_client_unittest.cc b/remoting/protocol/connection_to_client_unittest.cc
index bb73a8f3d1cb36ffee2a2f72329c9af936cd83ca..378ac3e86c43f21b519bac021096c3b8d6a65543 100644
--- a/remoting/protocol/connection_to_client_unittest.cc
+++ b/remoting/protocol/connection_to_client_unittest.cc
@@ -55,6 +55,8 @@ TEST_F(ConnectionToClientTest, SendUpdateStream) {
viewer_->video_stub()->ProcessVideoPacket(
packet, new DeleteTask<VideoPacket>(packet));
+ message_loop_.RunAllPending();
+
// And then close the connection to ConnectionToClient.
viewer_->Disconnect();
@@ -65,6 +67,21 @@ TEST_F(ConnectionToClientTest, SendUpdateStream) {
EXPECT_GT(session_->video_channel()->written_data().size(), 0u);
}
+TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) {
+ // Then send the actual data.
+ VideoPacket* packet = new VideoPacket();
+ viewer_->video_stub()->ProcessVideoPacket(
+ packet, new DeleteTask<VideoPacket>(packet));
+
+ // And then close the connection to ConnectionToClient.
+ viewer_->Disconnect();
+
+ message_loop_.RunAllPending();
+
+ // Nothing should be written because connection has been closed.
+ EXPECT_EQ(session_->video_channel()->written_data().size(), 0u);
+}
+
TEST_F(ConnectionToClientTest, StateChange) {
EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get()));
session_->state_change_callback()->Run(protocol::Session::CLOSED);

Powered by Google App Engine
This is Rietveld 408576698