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 "components/signin/core/browser/signin_manager.h" | 5 #include "components/signin/core/browser/signin_manager.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername)); | 437 profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername)); |
438 | 438 |
439 // Make sure account tracker was updated. | 439 // Make sure account tracker was updated. |
440 AccountTrackerService* service = | 440 AccountTrackerService* service = |
441 AccountTrackerServiceFactory::GetForProfile(profile()); | 441 AccountTrackerServiceFactory::GetForProfile(profile()); |
442 AccountTrackerService::AccountInfo info = service->GetAccountInfo( | 442 AccountTrackerService::AccountInfo info = service->GetAccountInfo( |
443 manager_->GetAuthenticatedAccountId()); | 443 manager_->GetAuthenticatedAccountId()); |
444 EXPECT_EQ("user@gmail.com", info.email); | 444 EXPECT_EQ("user@gmail.com", info.email); |
445 EXPECT_EQ("account_id", info.gaia); | 445 EXPECT_EQ("account_id", info.gaia); |
446 } | 446 } |
| 447 |
| 448 TEST_F(SigninManagerTest, CanonicalizesPrefs) { |
| 449 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
| 450 "user.C@gmail.com"); |
| 451 CreateNakedSigninManager(); |
| 452 manager_->Initialize(g_browser_process->local_state()); |
| 453 EXPECT_EQ("user.C@gmail.com", manager_->GetAuthenticatedUsername()); |
| 454 |
| 455 // TODO(rogerta): until the migration to gaia id, the account id will remain |
| 456 // the old username. |
| 457 EXPECT_EQ("userc@gmail.com", manager_->GetAuthenticatedAccountId()); |
| 458 EXPECT_EQ("userc@gmail.com", |
| 459 profile()->GetPrefs()->GetString(prefs::kGoogleServicesAccountId)); |
| 460 EXPECT_EQ("", |
| 461 profile()->GetPrefs()->GetString(prefs::kGoogleServicesUsername)); |
| 462 |
| 463 // Make sure account tracker has a canonicalized username. |
| 464 AccountTrackerService* service = |
| 465 AccountTrackerServiceFactory::GetForProfile(profile()); |
| 466 AccountTrackerService::AccountInfo info = service->GetAccountInfo( |
| 467 manager_->GetAuthenticatedAccountId()); |
| 468 EXPECT_EQ("user.C@gmail.com", info.email); |
| 469 EXPECT_EQ("userc@gmail.com", info.account_id); |
| 470 } |
OLD | NEW |