| 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/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 TEST_F(ConnectionToClientTest, SendUpdateStream) { | 64 TEST_F(ConnectionToClientTest, SendUpdateStream) { |
| 65 scoped_ptr<VideoPacket> packet(new VideoPacket()); | 65 scoped_ptr<VideoPacket> packet(new VideoPacket()); |
| 66 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); | 66 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); |
| 67 | 67 |
| 68 base::RunLoop().RunUntilIdle(); | 68 base::RunLoop().RunUntilIdle(); |
| 69 | 69 |
| 70 // Verify that something has been written. | 70 // Verify that something has been written. |
| 71 // TODO(sergeyu): Verify that the correct data has been written. | 71 // TODO(sergeyu): Verify that the correct data has been written. |
| 72 ASSERT_TRUE(session_->GetStreamChannel(kVideoChannelName)); | 72 ASSERT_TRUE(session_->fake_channel_factory().GetChannel(kVideoChannelName)); |
| 73 EXPECT_GT(session_->GetStreamChannel(kVideoChannelName)-> | 73 EXPECT_GT(session_->fake_channel_factory().GetChannel(kVideoChannelName)-> |
| 74 written_data().size(), 0u); | 74 written_data().size(), 0u); |
| 75 | 75 |
| 76 // And then close the connection to ConnectionToClient. | 76 // And then close the connection to ConnectionToClient. |
| 77 viewer_->Disconnect(); | 77 viewer_->Disconnect(); |
| 78 | 78 |
| 79 base::RunLoop().RunUntilIdle(); | 79 base::RunLoop().RunUntilIdle(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { | 82 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { |
| 83 scoped_ptr<VideoPacket> packet(new VideoPacket()); | 83 scoped_ptr<VideoPacket> packet(new VideoPacket()); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 98 base::RunLoop().RunUntilIdle(); | 98 base::RunLoop().RunUntilIdle(); |
| 99 | 99 |
| 100 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED)); | 100 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED)); |
| 101 session_->set_error(SESSION_REJECTED); | 101 session_->set_error(SESSION_REJECTED); |
| 102 session_->event_handler()->OnSessionStateChange(Session::FAILED); | 102 session_->event_handler()->OnSessionStateChange(Session::FAILED); |
| 103 base::RunLoop().RunUntilIdle(); | 103 base::RunLoop().RunUntilIdle(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // namespace protocol | 106 } // namespace protocol |
| 107 } // namespace remoting | 107 } // namespace remoting |
| OLD | NEW |