| 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/fake_authenticator.h" | 5 #include "remoting/protocol/fake_authenticator.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base64.h" | 9 #include "base/base64.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 | 182 |
| 183 const std::string& FakeAuthenticator::GetAuthKey() const { | 183 const std::string& FakeAuthenticator::GetAuthKey() const { |
| 184 EXPECT_EQ(ACCEPTED, state()); | 184 EXPECT_EQ(ACCEPTED, state()); |
| 185 DCHECK(!auth_key_.empty()); | 185 DCHECK(!auth_key_.empty()); |
| 186 return auth_key_; | 186 return auth_key_; |
| 187 } | 187 } |
| 188 | 188 |
| 189 std::unique_ptr<ChannelAuthenticator> | 189 std::unique_ptr<ChannelAuthenticator> |
| 190 FakeAuthenticator::CreateChannelAuthenticator() const { | 190 FakeAuthenticator::CreateChannelAuthenticator() const { |
| 191 EXPECT_EQ(ACCEPTED, state()); | 191 EXPECT_EQ(ACCEPTED, state()); |
| 192 return base::WrapUnique( | 192 return base::MakeUnique<FakeChannelAuthenticator>(action_ != REJECT_CHANNEL, |
| 193 new FakeChannelAuthenticator(action_ != REJECT_CHANNEL, async_)); | 193 async_); |
| 194 } | 194 } |
| 195 | 195 |
| 196 FakeHostAuthenticatorFactory::FakeHostAuthenticatorFactory( | 196 FakeHostAuthenticatorFactory::FakeHostAuthenticatorFactory( |
| 197 int round_trips, | 197 int round_trips, |
| 198 int messages_till_started, | 198 int messages_till_started, |
| 199 FakeAuthenticator::Action action, | 199 FakeAuthenticator::Action action, |
| 200 bool async) | 200 bool async) |
| 201 : round_trips_(round_trips), | 201 : round_trips_(round_trips), |
| 202 messages_till_started_(messages_till_started), | 202 messages_till_started_(messages_till_started), |
| 203 action_(action), | 203 action_(action), |
| 204 async_(async) {} | 204 async_(async) {} |
| 205 FakeHostAuthenticatorFactory::~FakeHostAuthenticatorFactory() {} | 205 FakeHostAuthenticatorFactory::~FakeHostAuthenticatorFactory() {} |
| 206 | 206 |
| 207 std::unique_ptr<Authenticator> | 207 std::unique_ptr<Authenticator> |
| 208 FakeHostAuthenticatorFactory::CreateAuthenticator( | 208 FakeHostAuthenticatorFactory::CreateAuthenticator( |
| 209 const std::string& local_jid, | 209 const std::string& local_jid, |
| 210 const std::string& remote_jid) { | 210 const std::string& remote_jid) { |
| 211 std::unique_ptr<FakeAuthenticator> authenticator(new FakeAuthenticator( | 211 std::unique_ptr<FakeAuthenticator> authenticator(new FakeAuthenticator( |
| 212 FakeAuthenticator::HOST, round_trips_, action_, async_)); | 212 FakeAuthenticator::HOST, round_trips_, action_, async_)); |
| 213 authenticator->set_messages_till_started(messages_till_started_); | 213 authenticator->set_messages_till_started(messages_till_started_); |
| 214 return std::move(authenticator); | 214 return std::move(authenticator); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace protocol | 217 } // namespace protocol |
| 218 } // namespace remoting | 218 } // namespace remoting |
| OLD | NEW |