Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3282)

Unified Diff: chrome/browser/signin/signin_names_io_thread_unittest.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: rebased Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698