Chromium Code Reviews| Index: chrome/browser/signin/signin_names_io_thread_unittest.cc |
| diff --git a/chrome/browser/signin/signin_names_io_thread_unittest.cc b/chrome/browser/signin/signin_names_io_thread_unittest.cc |
| index d79013e9f3692af645050e437f47710a2f972e6b..2a7ceeb73c7f165158af769d94e8437bd2384065 100644 |
| --- a/chrome/browser/signin/signin_names_io_thread_unittest.cc |
| +++ b/chrome/browser/signin/signin_names_io_thread_unittest.cc |
| @@ -8,11 +8,13 @@ |
| #include "base/strings/utf_string_conversions.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/profiles/profile_info_cache.h" |
| +#include "chrome/browser/signin/account_tracker_service_factory.h" |
| #include "chrome/browser/signin/fake_signin_manager.h" |
| #include "chrome/browser/signin/signin_names_io_thread.h" |
| #include "chrome/test/base/testing_browser_process.h" |
| #include "chrome/test/base/testing_profile.h" |
| #include "chrome/test/base/testing_profile_manager.h" |
| +#include "components/signin/core/browser/account_tracker_service.h" |
| #include "components/signin/core/browser/signin_manager.h" |
| #include "content/public/browser/notification_service.h" |
| #include "content/public/test/test_browser_thread.h" |
| @@ -25,6 +27,11 @@ class SigninNamesOnIOThreadTest : public testing::Test { |
| void SetUp() override; |
| void TearDown() override; |
| + // Seed the account tracker with information from logged in user. Normally |
| + // this is done by UI code before calling SigninManager. Returns the string |
| + // to use as the account_id. |
| + std::string AddToAccountTracker(const std::string& gaia_id, |
| + const std::string& email); |
| void SimulateSignin(const base::string16& email); |
| void AddNewProfile(const base::string16& name, const base::string16& email); |
| @@ -58,8 +65,22 @@ void SigninNamesOnIOThreadTest::TearDown() { |
| signin_names_.ReleaseResourcesOnUIThread(); |
| } |
| +// Seed the account tracker with information from logged in user. Normally |
| +// this is done by UI code before calling SigninManager. Returns the string |
| +// to use as the account_id. |
| +std::string SigninNamesOnIOThreadTest::AddToAccountTracker( |
| + const std::string& gaia_id, |
| + const std::string& email) { |
| + AccountTrackerService* service = |
| + AccountTrackerServiceFactory::GetForProfile(profile_.get()); |
| + service->SeedAccountInfo(gaia_id, email); |
|
Mike Lerman
2015/04/08 14:45:26
Don't think this needs to be its own method (see s
Roger Tawa OOO till Jul 10th
2015/04/08 20:24:20
Done.
|
| + return service->PickAccountIdForAccount(gaia_id, email); |
| +} |
| + |
| void SigninNamesOnIOThreadTest::SimulateSignin(const base::string16& email) { |
| - signin_manager_->SignIn(base::UTF16ToUTF8(email), "password"); |
| + std::string email_str = base::UTF16ToUTF8(email); |
| + AddToAccountTracker("gaia_id", email_str); |
|
Mike Lerman
2015/04/08 14:45:26
Similarly to signin_tracker_unittest. Why not just
Roger Tawa OOO till Jul 10th
2015/04/08 20:24:20
Return value not used. Put code inline here since
|
| + signin_manager_->SignIn("gaia_id", email_str, "password"); |
| } |
| void SigninNamesOnIOThreadTest::AddNewProfile(const base::string16& name, |