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( |
73 EXPECT_GT(session_->GetStreamChannel(kVideoChannelName)-> | 73 session_->fake_channel_factory().GetFakeChannel(kVideoChannelName)); |
74 written_data().size(), 0u); | 74 EXPECT_FALSE(session_->fake_channel_factory() |
| 75 .GetFakeChannel(kVideoChannelName)->written_data().empty()); |
75 | 76 |
76 // And then close the connection to ConnectionToClient. | 77 // And then close the connection to ConnectionToClient. |
77 viewer_->Disconnect(); | 78 viewer_->Disconnect(); |
78 | 79 |
79 base::RunLoop().RunUntilIdle(); | 80 base::RunLoop().RunUntilIdle(); |
80 } | 81 } |
81 | 82 |
82 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { | 83 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { |
83 scoped_ptr<VideoPacket> packet(new VideoPacket()); | 84 scoped_ptr<VideoPacket> packet(new VideoPacket()); |
84 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); | 85 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); |
(...skipping 13 matching lines...) Expand all Loading... |
98 base::RunLoop().RunUntilIdle(); | 99 base::RunLoop().RunUntilIdle(); |
99 | 100 |
100 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED)); | 101 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED)); |
101 session_->set_error(SESSION_REJECTED); | 102 session_->set_error(SESSION_REJECTED); |
102 session_->event_handler()->OnSessionStateChange(Session::FAILED); | 103 session_->event_handler()->OnSessionStateChange(Session::FAILED); |
103 base::RunLoop().RunUntilIdle(); | 104 base::RunLoop().RunUntilIdle(); |
104 } | 105 } |
105 | 106 |
106 } // namespace protocol | 107 } // namespace protocol |
107 } // namespace remoting | 108 } // namespace remoting |
OLD | NEW |