| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/protocol/connection_to_client.h" | 5 #include "remoting/protocol/connection_to_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "remoting/base/constants.h" | 10 #include "remoting/base/constants.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 TEST_F(ConnectionToClientTest, SendUpdateStream) { | 69 TEST_F(ConnectionToClientTest, SendUpdateStream) { |
| 70 scoped_ptr<VideoPacket> packet(new VideoPacket()); | 70 scoped_ptr<VideoPacket> packet(new VideoPacket()); |
| 71 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); | 71 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); |
| 72 | 72 |
| 73 base::RunLoop().RunUntilIdle(); | 73 base::RunLoop().RunUntilIdle(); |
| 74 | 74 |
| 75 // Verify that something has been written. | 75 // Verify that something has been written. |
| 76 // TODO(sergeyu): Verify that the correct data has been written. | 76 // TODO(sergeyu): Verify that the correct data has been written. |
| 77 ASSERT_TRUE( | 77 FakeStreamSocket* channel = session_->GetTransportSession() |
| 78 session_->fake_channel_factory().GetFakeChannel(kVideoChannelName)); | 78 ->GetStreamChannelFactory() |
| 79 EXPECT_FALSE(session_->fake_channel_factory() | 79 ->GetFakeChannel(kVideoChannelName); |
| 80 .GetFakeChannel(kVideoChannelName)->written_data().empty()); | 80 ASSERT_TRUE(channel); |
| 81 EXPECT_FALSE(channel->written_data().empty()); |
| 81 | 82 |
| 82 // And then close the connection to ConnectionToClient. | 83 // And then close the connection to ConnectionToClient. |
| 83 viewer_->Disconnect(); | 84 viewer_->Disconnect(); |
| 84 | 85 |
| 85 base::RunLoop().RunUntilIdle(); | 86 base::RunLoop().RunUntilIdle(); |
| 86 } | 87 } |
| 87 | 88 |
| 88 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { | 89 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { |
| 89 scoped_ptr<VideoPacket> packet(new VideoPacket()); | 90 scoped_ptr<VideoPacket> packet(new VideoPacket()); |
| 90 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); | 91 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 104 base::RunLoop().RunUntilIdle(); | 105 base::RunLoop().RunUntilIdle(); |
| 105 | 106 |
| 106 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED)); | 107 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED)); |
| 107 session_->set_error(SESSION_REJECTED); | 108 session_->set_error(SESSION_REJECTED); |
| 108 session_->event_handler()->OnSessionStateChange(Session::FAILED); | 109 session_->event_handler()->OnSessionStateChange(Session::FAILED); |
| 109 base::RunLoop().RunUntilIdle(); | 110 base::RunLoop().RunUntilIdle(); |
| 110 } | 111 } |
| 111 | 112 |
| 112 } // namespace protocol | 113 } // namespace protocol |
| 113 } // namespace remoting | 114 } // namespace remoting |
| OLD | NEW |