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 FakeStreamSocket* channel = session_->GetTransportSession() | 77 ASSERT_TRUE( |
78 ->GetStreamChannelFactory() | 78 session_->fake_channel_factory().GetFakeChannel(kVideoChannelName)); |
79 ->GetFakeChannel(kVideoChannelName); | 79 EXPECT_FALSE(session_->fake_channel_factory() |
80 ASSERT_TRUE(channel); | 80 .GetFakeChannel(kVideoChannelName)->written_data().empty()); |
81 EXPECT_FALSE(channel->written_data().empty()); | |
82 | 81 |
83 // And then close the connection to ConnectionToClient. | 82 // And then close the connection to ConnectionToClient. |
84 viewer_->Disconnect(); | 83 viewer_->Disconnect(); |
85 | 84 |
86 base::RunLoop().RunUntilIdle(); | 85 base::RunLoop().RunUntilIdle(); |
87 } | 86 } |
88 | 87 |
89 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { | 88 TEST_F(ConnectionToClientTest, NoWriteAfterDisconnect) { |
90 scoped_ptr<VideoPacket> packet(new VideoPacket()); | 89 scoped_ptr<VideoPacket> packet(new VideoPacket()); |
91 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); | 90 viewer_->video_stub()->ProcessVideoPacket(packet.Pass(), base::Closure()); |
(...skipping 13 matching lines...) Expand all Loading... |
105 base::RunLoop().RunUntilIdle(); | 104 base::RunLoop().RunUntilIdle(); |
106 | 105 |
107 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED)); | 106 EXPECT_CALL(handler_, OnConnectionClosed(viewer_.get(), SESSION_REJECTED)); |
108 session_->set_error(SESSION_REJECTED); | 107 session_->set_error(SESSION_REJECTED); |
109 session_->event_handler()->OnSessionStateChange(Session::FAILED); | 108 session_->event_handler()->OnSessionStateChange(Session::FAILED); |
110 base::RunLoop().RunUntilIdle(); | 109 base::RunLoop().RunUntilIdle(); |
111 } | 110 } |
112 | 111 |
113 } // namespace protocol | 112 } // namespace protocol |
114 } // namespace remoting | 113 } // namespace remoting |
OLD | NEW |