OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
11 #include "remoting/base/constants.h" | 11 #include "remoting/base/constants.h" |
12 #include "remoting/protocol/fake_session.h" | 12 #include "remoting/protocol/fake_session.h" |
| 13 #include "remoting/protocol/fake_video_renderer.h" |
13 #include "remoting/protocol/ice_connection_to_client.h" | 14 #include "remoting/protocol/ice_connection_to_client.h" |
14 #include "remoting/protocol/ice_connection_to_host.h" | 15 #include "remoting/protocol/ice_connection_to_host.h" |
15 #include "remoting/protocol/protocol_mock_objects.h" | 16 #include "remoting/protocol/protocol_mock_objects.h" |
16 #include "remoting/protocol/transport_context.h" | 17 #include "remoting/protocol/transport_context.h" |
17 #include "remoting/protocol/webrtc_connection_to_client.h" | 18 #include "remoting/protocol/webrtc_connection_to_client.h" |
18 #include "remoting/protocol/webrtc_connection_to_host.h" | 19 #include "remoting/protocol/webrtc_connection_to_host.h" |
19 #include "testing/gmock/include/gmock/gmock.h" | 20 #include "testing/gmock/include/gmock/gmock.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 21 #include "testing/gtest/include/gtest/gtest.h" |
21 | 22 |
22 using ::testing::_; | 23 using ::testing::_; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 84 |
84 // Setup host side. | 85 // Setup host side. |
85 host_connection_->SetEventHandler(&host_event_handler_); | 86 host_connection_->SetEventHandler(&host_event_handler_); |
86 host_connection_->set_clipboard_stub(&host_clipboard_stub_); | 87 host_connection_->set_clipboard_stub(&host_clipboard_stub_); |
87 host_connection_->set_host_stub(&host_stub_); | 88 host_connection_->set_host_stub(&host_stub_); |
88 host_connection_->set_input_stub(&host_input_stub_); | 89 host_connection_->set_input_stub(&host_input_stub_); |
89 | 90 |
90 // Setup client side. | 91 // Setup client side. |
91 client_connection_->set_client_stub(&client_stub_); | 92 client_connection_->set_client_stub(&client_stub_); |
92 client_connection_->set_clipboard_stub(&client_clipboard_stub_); | 93 client_connection_->set_clipboard_stub(&client_clipboard_stub_); |
93 client_connection_->set_video_stub(&client_video_stub_); | 94 client_connection_->set_video_renderer(&client_video_renderer_); |
94 } | 95 } |
95 | 96 |
96 void Connect() { | 97 void Connect() { |
97 { | 98 { |
98 testing::InSequence sequence; | 99 testing::InSequence sequence; |
99 EXPECT_CALL(host_event_handler_, | 100 EXPECT_CALL(host_event_handler_, |
100 OnConnectionAuthenticating(host_connection_.get())); | 101 OnConnectionAuthenticating(host_connection_.get())); |
101 EXPECT_CALL(host_event_handler_, | 102 EXPECT_CALL(host_event_handler_, |
102 OnConnectionAuthenticated(host_connection_.get())); | 103 OnConnectionAuthenticated(host_connection_.get())); |
103 } | 104 } |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 MockClipboardStub host_clipboard_stub_; | 161 MockClipboardStub host_clipboard_stub_; |
161 MockHostStub host_stub_; | 162 MockHostStub host_stub_; |
162 MockInputStub host_input_stub_; | 163 MockInputStub host_input_stub_; |
163 scoped_ptr<ConnectionToClient> host_connection_; | 164 scoped_ptr<ConnectionToClient> host_connection_; |
164 FakeSession* host_session_; // Owned by |host_connection_|. | 165 FakeSession* host_session_; // Owned by |host_connection_|. |
165 bool host_connected_ = false; | 166 bool host_connected_ = false; |
166 | 167 |
167 MockConnectionToHostEventCallback client_event_handler_; | 168 MockConnectionToHostEventCallback client_event_handler_; |
168 MockClientStub client_stub_; | 169 MockClientStub client_stub_; |
169 MockClipboardStub client_clipboard_stub_; | 170 MockClipboardStub client_clipboard_stub_; |
170 MockVideoStub client_video_stub_; | 171 FakeVideoRenderer client_video_renderer_; |
171 scoped_ptr<ConnectionToHost> client_connection_; | 172 scoped_ptr<ConnectionToHost> client_connection_; |
172 FakeSession* client_session_; // Owned by |client_connection_|. | 173 FakeSession* client_session_; // Owned by |client_connection_|. |
173 scoped_ptr<FakeSession> owned_client_session_; | 174 scoped_ptr<FakeSession> owned_client_session_; |
174 bool client_connected_ = false; | 175 bool client_connected_ = false; |
175 | 176 |
176 private: | 177 private: |
177 DISALLOW_COPY_AND_ASSIGN(ConnectionTest); | 178 DISALLOW_COPY_AND_ASSIGN(ConnectionTest); |
178 }; | 179 }; |
179 | 180 |
180 INSTANTIATE_TEST_CASE_P(Ice, ConnectionTest, ::testing::Values(false)); | 181 INSTANTIATE_TEST_CASE_P(Ice, ConnectionTest, ::testing::Values(false)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(event))); | 233 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(event))); |
233 | 234 |
234 // Send capabilities from the client. | 235 // Send capabilities from the client. |
235 client_connection_->input_stub()->InjectKeyEvent(event); | 236 client_connection_->input_stub()->InjectKeyEvent(event); |
236 | 237 |
237 base::RunLoop().RunUntilIdle(); | 238 base::RunLoop().RunUntilIdle(); |
238 } | 239 } |
239 | 240 |
240 } // namespace protocol | 241 } // namespace protocol |
241 } // namespace remoting | 242 } // namespace remoting |
OLD | NEW |