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/fake_extended_authenticator.h" | 5 #include "chromeos/login/auth/fake_extended_authenticator.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chromeos/login/auth/auth_status_consumer.h" | 8 #include "chromeos/login/auth/auth_status_consumer.h" |
| 9 #include "components/signin/core/account_id/account_id.h" |
9 | 10 |
10 namespace chromeos { | 11 namespace chromeos { |
11 | 12 |
12 FakeExtendedAuthenticator::FakeExtendedAuthenticator( | 13 FakeExtendedAuthenticator::FakeExtendedAuthenticator( |
13 NewAuthStatusConsumer* consumer, | 14 NewAuthStatusConsumer* consumer, |
14 const UserContext& expected_user_context) | 15 const UserContext& expected_user_context) |
15 : consumer_(consumer), | 16 : consumer_(consumer), |
16 old_consumer_(NULL), | 17 old_consumer_(NULL), |
17 expected_user_context_(expected_user_context) { | 18 expected_user_context_(expected_user_context) { |
18 } | 19 } |
(...skipping 11 matching lines...) Expand all Loading... |
30 | 31 |
31 void FakeExtendedAuthenticator::SetConsumer(AuthStatusConsumer* consumer) { | 32 void FakeExtendedAuthenticator::SetConsumer(AuthStatusConsumer* consumer) { |
32 old_consumer_ = consumer; | 33 old_consumer_ = consumer; |
33 } | 34 } |
34 | 35 |
35 void FakeExtendedAuthenticator::AuthenticateToMount( | 36 void FakeExtendedAuthenticator::AuthenticateToMount( |
36 const UserContext& context, | 37 const UserContext& context, |
37 const ResultCallback& success_callback) { | 38 const ResultCallback& success_callback) { |
38 if (expected_user_context_ == context) { | 39 if (expected_user_context_ == context) { |
39 UserContext reported_user_context(context); | 40 UserContext reported_user_context(context); |
40 const std::string mount_hash = reported_user_context.GetUserID() + "-hash"; | 41 const std::string mount_hash = |
| 42 reported_user_context.GetUserID().GetUserEmail() + "-hash"; |
41 reported_user_context.SetUserIDHash(mount_hash); | 43 reported_user_context.SetUserIDHash(mount_hash); |
42 if (!success_callback.is_null()) | 44 if (!success_callback.is_null()) |
43 success_callback.Run(mount_hash); | 45 success_callback.Run(mount_hash); |
44 OnAuthSuccess(reported_user_context); | 46 OnAuthSuccess(reported_user_context); |
45 return; | 47 return; |
46 } | 48 } |
47 | 49 |
48 OnAuthFailure(FAILED_MOUNT, | 50 OnAuthFailure(FAILED_MOUNT, |
49 AuthFailure(AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME)); | 51 AuthFailure(AuthFailure::COULD_NOT_MOUNT_CRYPTOHOME)); |
50 } | 52 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 106 |
105 void FakeExtendedAuthenticator::OnAuthFailure(AuthState state, | 107 void FakeExtendedAuthenticator::OnAuthFailure(AuthState state, |
106 const AuthFailure& error) { | 108 const AuthFailure& error) { |
107 if (consumer_) | 109 if (consumer_) |
108 consumer_->OnAuthenticationFailure(state); | 110 consumer_->OnAuthenticationFailure(state); |
109 if (old_consumer_) | 111 if (old_consumer_) |
110 old_consumer_->OnAuthFailure(error); | 112 old_consumer_->OnAuthFailure(error); |
111 } | 113 } |
112 | 114 |
113 } // namespace chromeos | 115 } // namespace chromeos |
OLD | NEW |