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 "chrome/browser/chromeos/login/test_login_utils.h" | 5 #include "chrome/browser/chromeos/login/test_login_utils.h" |
6 | 6 |
| 7 #include "base/logging.h" |
7 #include "chrome/browser/chromeos/login/auth/mock_authenticator.h" | 8 #include "chrome/browser/chromeos/login/auth/mock_authenticator.h" |
8 #include "chrome/browser/chromeos/login/auth/user_context.h" | 9 #include "chrome/browser/chromeos/login/auth/user_context.h" |
9 | 10 |
10 namespace chromeos { | 11 namespace chromeos { |
11 | 12 |
12 TestLoginUtils::TestLoginUtils(const std::string& expected_username, | 13 TestLoginUtils::TestLoginUtils(const UserContext& user_context) |
13 const std::string& expected_password) | 14 : expected_user_context_(user_context) { |
14 : expected_username_(expected_username), | |
15 expected_password_(expected_password) { | |
16 } | 15 } |
17 | 16 |
18 TestLoginUtils::~TestLoginUtils() {} | 17 TestLoginUtils::~TestLoginUtils() {} |
19 | 18 |
20 void TestLoginUtils::PrepareProfile( | 19 void TestLoginUtils::PrepareProfile( |
21 const UserContext& credentials, | 20 const UserContext& user_context, |
22 const std::string& display_email, | 21 const std::string& display_email, |
23 bool has_cookies, | 22 bool has_cookies, |
24 bool has_active_session, | 23 bool has_active_session, |
25 Delegate* delegate) { | 24 Delegate* delegate) { |
26 DCHECK_EQ(expected_username_, credentials.GetUserID()); | 25 if (user_context != expected_user_context_) |
27 DCHECK_EQ(expected_password_, credentials.GetPassword()); | 26 NOTREACHED(); |
28 // Profile hasn't been loaded. | 27 // Profile hasn't been loaded. |
29 delegate->OnProfilePrepared(NULL); | 28 delegate->OnProfilePrepared(NULL); |
30 } | 29 } |
31 | 30 |
32 void TestLoginUtils::DelegateDeleted(Delegate* delegate) { | 31 void TestLoginUtils::DelegateDeleted(Delegate* delegate) { |
33 } | 32 } |
34 | 33 |
35 scoped_refptr<Authenticator> TestLoginUtils::CreateAuthenticator( | 34 scoped_refptr<Authenticator> TestLoginUtils::CreateAuthenticator( |
36 LoginStatusConsumer* consumer) { | 35 LoginStatusConsumer* consumer) { |
37 return new MockAuthenticator( | 36 return new MockAuthenticator(consumer, expected_user_context_); |
38 consumer, expected_username_, expected_password_); | |
39 } | 37 } |
40 | 38 |
41 void TestLoginUtils::InitRlzDelayed(Profile* user_profile) { | 39 void TestLoginUtils::InitRlzDelayed(Profile* user_profile) { |
42 } | 40 } |
43 | 41 |
44 } // namespace chromeos | 42 } // namespace chromeos |
OLD | NEW |