| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "remoting/base/constants.h" | 8 #include "remoting/base/constants.h" |
| 9 #include "remoting/protocol/fake_session.h" | 9 #include "remoting/protocol/fake_session.h" |
| 10 #include "remoting/protocol/ice_connection_to_client.h" | 10 #include "remoting/protocol/ice_connection_to_client.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 { | 100 { |
| 101 testing::InSequence sequence; | 101 testing::InSequence sequence; |
| 102 EXPECT_CALL(client_event_handler_, | 102 EXPECT_CALL(client_event_handler_, |
| 103 OnConnectionState(ConnectionToHost::CONNECTING, OK)); | 103 OnConnectionState(ConnectionToHost::CONNECTING, OK)); |
| 104 EXPECT_CALL(client_event_handler_, | 104 EXPECT_CALL(client_event_handler_, |
| 105 OnConnectionState(ConnectionToHost::AUTHENTICATED, OK)); | 105 OnConnectionState(ConnectionToHost::AUTHENTICATED, OK)); |
| 106 EXPECT_CALL(client_event_handler_, | 106 EXPECT_CALL(client_event_handler_, |
| 107 OnConnectionState(ConnectionToHost::CONNECTED, OK)); | 107 OnConnectionState(ConnectionToHost::CONNECTED, OK)); |
| 108 } | 108 } |
| 109 | 109 |
| 110 client_connection_->Connect(owned_client_session_.Pass(), | 110 client_connection_->Connect(std::move(owned_client_session_), |
| 111 &client_event_handler_); | 111 &client_event_handler_); |
| 112 client_session_->SimulateConnection(host_session_); | 112 client_session_->SimulateConnection(host_session_); |
| 113 base::RunLoop().RunUntilIdle(); | 113 base::RunLoop().RunUntilIdle(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void TearDown() override { | 116 void TearDown() override { |
| 117 client_connection_.reset(); | 117 client_connection_.reset(); |
| 118 host_connection_.reset(); | 118 host_connection_.reset(); |
| 119 base::RunLoop().RunUntilIdle(); | 119 base::RunLoop().RunUntilIdle(); |
| 120 } | 120 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 142 | 142 |
| 143 INSTANTIATE_TEST_CASE_P(Ice, ConnectionTest, ::testing::Values(false)); | 143 INSTANTIATE_TEST_CASE_P(Ice, ConnectionTest, ::testing::Values(false)); |
| 144 INSTANTIATE_TEST_CASE_P(Webrtc, ConnectionTest, ::testing::Values(true)); | 144 INSTANTIATE_TEST_CASE_P(Webrtc, ConnectionTest, ::testing::Values(true)); |
| 145 | 145 |
| 146 TEST_P(ConnectionTest, RejectConnection) { | 146 TEST_P(ConnectionTest, RejectConnection) { |
| 147 EXPECT_CALL(client_event_handler_, | 147 EXPECT_CALL(client_event_handler_, |
| 148 OnConnectionState(ConnectionToHost::CONNECTING, OK)); | 148 OnConnectionState(ConnectionToHost::CONNECTING, OK)); |
| 149 EXPECT_CALL(client_event_handler_, | 149 EXPECT_CALL(client_event_handler_, |
| 150 OnConnectionState(ConnectionToHost::CLOSED, OK)); | 150 OnConnectionState(ConnectionToHost::CLOSED, OK)); |
| 151 | 151 |
| 152 client_connection_->Connect(owned_client_session_.Pass(), | 152 client_connection_->Connect(std::move(owned_client_session_), |
| 153 &client_event_handler_); | 153 &client_event_handler_); |
| 154 client_session_->event_handler()->OnSessionStateChange(Session::CLOSED); | 154 client_session_->event_handler()->OnSessionStateChange(Session::CLOSED); |
| 155 } | 155 } |
| 156 | 156 |
| 157 TEST_P(ConnectionTest, Disconnect) { | 157 TEST_P(ConnectionTest, Disconnect) { |
| 158 Connect(); | 158 Connect(); |
| 159 | 159 |
| 160 EXPECT_CALL(client_event_handler_, | 160 EXPECT_CALL(client_event_handler_, |
| 161 OnConnectionState(ConnectionToHost::CLOSED, OK)); | 161 OnConnectionState(ConnectionToHost::CLOSED, OK)); |
| 162 EXPECT_CALL(host_event_handler_, | 162 EXPECT_CALL(host_event_handler_, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 193 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(event))); | 193 EXPECT_CALL(host_input_stub_, InjectKeyEvent(EqualsKeyEvent(event))); |
| 194 | 194 |
| 195 // Send capabilities from the client. | 195 // Send capabilities from the client. |
| 196 client_connection_->input_stub()->InjectKeyEvent(event); | 196 client_connection_->input_stub()->InjectKeyEvent(event); |
| 197 | 197 |
| 198 base::RunLoop().RunUntilIdle(); | 198 base::RunLoop().RunUntilIdle(); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace protocol | 201 } // namespace protocol |
| 202 } // namespace remoting | 202 } // namespace remoting |
| OLD | NEW |