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/authenticator_test_base.h" | 5 #include "remoting/protocol/authenticator_test_base.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 base::Unretained(receiver), base::Unretained(sender), | 109 base::Unretained(receiver), base::Unretained(sender), |
110 receiver->started(), sender->started())); | 110 receiver->started(), sender->started())); |
111 } | 111 } |
112 | 112 |
113 void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) { | 113 void AuthenticatorTestBase::RunChannelAuth(bool expected_fail) { |
114 client_fake_socket_.reset(new FakeStreamSocket()); | 114 client_fake_socket_.reset(new FakeStreamSocket()); |
115 host_fake_socket_.reset(new FakeStreamSocket()); | 115 host_fake_socket_.reset(new FakeStreamSocket()); |
116 client_fake_socket_->PairWith(host_fake_socket_.get()); | 116 client_fake_socket_->PairWith(host_fake_socket_.get()); |
117 | 117 |
118 client_auth_->SecureAndAuthenticate( | 118 client_auth_->SecureAndAuthenticate( |
119 client_fake_socket_.Pass(), | 119 std::move(client_fake_socket_), |
120 base::Bind(&AuthenticatorTestBase::OnClientConnected, | 120 base::Bind(&AuthenticatorTestBase::OnClientConnected, |
121 base::Unretained(this))); | 121 base::Unretained(this))); |
122 | 122 |
123 host_auth_->SecureAndAuthenticate( | 123 host_auth_->SecureAndAuthenticate( |
124 host_fake_socket_.Pass(), | 124 std::move(host_fake_socket_), |
125 base::Bind(&AuthenticatorTestBase::OnHostConnected, | 125 base::Bind(&AuthenticatorTestBase::OnHostConnected, |
126 base::Unretained(this))); | 126 base::Unretained(this))); |
127 | 127 |
128 // Expect two callbacks to be called - the client callback and the host | 128 // Expect two callbacks to be called - the client callback and the host |
129 // callback. | 129 // callback. |
130 int callback_counter = 2; | 130 int callback_counter = 2; |
131 | 131 |
132 EXPECT_CALL(client_callback_, OnDone(net::OK)) | 132 EXPECT_CALL(client_callback_, OnDone(net::OK)) |
133 .WillOnce(QuitThreadOnCounter(&callback_counter)); | 133 .WillOnce(QuitThreadOnCounter(&callback_counter)); |
134 if (expected_fail) { | 134 if (expected_fail) { |
(...skipping 18 matching lines...) Expand all Loading... |
153 if (!expected_fail) { | 153 if (!expected_fail) { |
154 ASSERT_TRUE(client_socket_.get() != nullptr); | 154 ASSERT_TRUE(client_socket_.get() != nullptr); |
155 ASSERT_TRUE(host_socket_.get() != nullptr); | 155 ASSERT_TRUE(host_socket_.get() != nullptr); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 void AuthenticatorTestBase::OnHostConnected( | 159 void AuthenticatorTestBase::OnHostConnected( |
160 int error, | 160 int error, |
161 scoped_ptr<P2PStreamSocket> socket) { | 161 scoped_ptr<P2PStreamSocket> socket) { |
162 host_callback_.OnDone(error); | 162 host_callback_.OnDone(error); |
163 host_socket_ = socket.Pass(); | 163 host_socket_ = std::move(socket); |
164 } | 164 } |
165 | 165 |
166 void AuthenticatorTestBase::OnClientConnected( | 166 void AuthenticatorTestBase::OnClientConnected( |
167 int error, | 167 int error, |
168 scoped_ptr<P2PStreamSocket> socket) { | 168 scoped_ptr<P2PStreamSocket> socket) { |
169 client_callback_.OnDone(error); | 169 client_callback_.OnDone(error); |
170 client_socket_ = socket.Pass(); | 170 client_socket_ = std::move(socket); |
171 } | 171 } |
172 | 172 |
173 } // namespace protocol | 173 } // namespace protocol |
174 } // namespace remoting | 174 } // namespace remoting |
OLD | NEW |