| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chromeos/login/auth/mock_authenticator.h" | 5 #include "chromeos/login/auth/mock_authenticator.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| 11 namespace chromeos { | 11 namespace chromeos { |
| 12 | 12 |
| 13 MockAuthenticator::MockAuthenticator(AuthStatusConsumer* consumer, | 13 MockAuthenticator::MockAuthenticator(AuthStatusConsumer* consumer, |
| 14 const UserContext& expected_user_context) | 14 const UserContext& expected_user_context) |
| 15 : Authenticator(consumer), | 15 : Authenticator(consumer), |
| 16 expected_user_context_(expected_user_context), | 16 expected_user_context_(expected_user_context), |
| 17 message_loop_(base::MessageLoopProxy::current()) { | 17 message_loop_(base::MessageLoopProxy::current()) { |
| 18 } | 18 } |
| 19 | 19 |
| 20 void MockAuthenticator::CompleteLogin(Profile* profile, | 20 void MockAuthenticator::CompleteLogin(content::BrowserContext* ignored, |
| 21 const UserContext& user_context) { | 21 const UserContext& user_context) { |
| 22 if (expected_user_context_ != user_context) | 22 if (expected_user_context_ != user_context) |
| 23 NOTREACHED(); | 23 NOTREACHED(); |
| 24 OnAuthSuccess(); | 24 OnAuthSuccess(); |
| 25 } | 25 } |
| 26 | 26 |
| 27 void MockAuthenticator::AuthenticateToLogin(Profile* profile, | 27 void MockAuthenticator::AuthenticateToLogin(content::BrowserContext* ignored, |
| 28 const UserContext& user_context) { | 28 const UserContext& user_context) { |
| 29 if (user_context == expected_user_context_) { | 29 if (user_context == expected_user_context_) { |
| 30 message_loop_->PostTask( | 30 message_loop_->PostTask( |
| 31 FROM_HERE, base::Bind(&MockAuthenticator::OnAuthSuccess, this)); | 31 FROM_HERE, base::Bind(&MockAuthenticator::OnAuthSuccess, this)); |
| 32 return; | 32 return; |
| 33 } | 33 } |
| 34 GoogleServiceAuthError error( | 34 GoogleServiceAuthError error( |
| 35 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 35 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
| 36 message_loop_->PostTask( | 36 message_loop_->PostTask( |
| 37 FROM_HERE, | 37 FROM_HERE, |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 void MockAuthenticator::SetExpectedCredentials( | 100 void MockAuthenticator::SetExpectedCredentials( |
| 101 const UserContext& user_context) { | 101 const UserContext& user_context) { |
| 102 expected_user_context_ = user_context; | 102 expected_user_context_ = user_context; |
| 103 } | 103 } |
| 104 | 104 |
| 105 MockAuthenticator::~MockAuthenticator() { | 105 MockAuthenticator::~MockAuthenticator() { |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace chromeos | 108 } // namespace chromeos |
| OLD | NEW |