| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 } | 77 } |
| 78 | 78 |
| 79 // static | 79 // static |
| 80 // This function sends a message from the sender and receiver and recursively | 80 // This function sends a message from the sender and receiver and recursively |
| 81 // calls itself to the send the next message from the receiver to the sender | 81 // calls itself to the send the next message from the receiver to the sender |
| 82 // untils the authentication completes. | 82 // untils the authentication completes. |
| 83 void AuthenticatorTestBase::ContinueAuthExchangeWith(Authenticator* sender, | 83 void AuthenticatorTestBase::ContinueAuthExchangeWith(Authenticator* sender, |
| 84 Authenticator* receiver, | 84 Authenticator* receiver, |
| 85 bool sender_started, | 85 bool sender_started, |
| 86 bool receiver_started) { | 86 bool receiver_started) { |
| 87 scoped_ptr<buzz::XmlElement> message; | 87 std::unique_ptr<buzz::XmlElement> message; |
| 88 ASSERT_NE(Authenticator::WAITING_MESSAGE, sender->state()); | 88 ASSERT_NE(Authenticator::WAITING_MESSAGE, sender->state()); |
| 89 if (sender->state() == Authenticator::ACCEPTED || | 89 if (sender->state() == Authenticator::ACCEPTED || |
| 90 sender->state() == Authenticator::REJECTED) { | 90 sender->state() == Authenticator::REJECTED) { |
| 91 return; | 91 return; |
| 92 } | 92 } |
| 93 | 93 |
| 94 // Verify that once the started flag for either party is set to true, | 94 // Verify that once the started flag for either party is set to true, |
| 95 // it should always stay true. | 95 // it should always stay true. |
| 96 if (receiver_started) { | 96 if (receiver_started) { |
| 97 ASSERT_TRUE(receiver->started()); | 97 ASSERT_TRUE(receiver->started()); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 testing::Mock::VerifyAndClearExpectations(&host_callback_); | 154 testing::Mock::VerifyAndClearExpectations(&host_callback_); |
| 155 | 155 |
| 156 if (!expected_fail) { | 156 if (!expected_fail) { |
| 157 ASSERT_TRUE(client_socket_.get() != nullptr); | 157 ASSERT_TRUE(client_socket_.get() != nullptr); |
| 158 ASSERT_TRUE(host_socket_.get() != nullptr); | 158 ASSERT_TRUE(host_socket_.get() != nullptr); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 void AuthenticatorTestBase::OnHostConnected( | 162 void AuthenticatorTestBase::OnHostConnected( |
| 163 int error, | 163 int error, |
| 164 scoped_ptr<P2PStreamSocket> socket) { | 164 std::unique_ptr<P2PStreamSocket> socket) { |
| 165 host_callback_.OnDone(error); | 165 host_callback_.OnDone(error); |
| 166 host_socket_ = std::move(socket); | 166 host_socket_ = std::move(socket); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void AuthenticatorTestBase::OnClientConnected( | 169 void AuthenticatorTestBase::OnClientConnected( |
| 170 int error, | 170 int error, |
| 171 scoped_ptr<P2PStreamSocket> socket) { | 171 std::unique_ptr<P2PStreamSocket> socket) { |
| 172 client_callback_.OnDone(error); | 172 client_callback_.OnDone(error); |
| 173 client_socket_ = std::move(socket); | 173 client_socket_ = std::move(socket); |
| 174 } | 174 } |
| 175 | 175 |
| 176 } // namespace protocol | 176 } // namespace protocol |
| 177 } // namespace remoting | 177 } // namespace remoting |
| OLD | NEW |