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

Unified Diff: ash/test/test_session_state_delegate.cc

Issue 1428213004: This CL replaces std::string user_id in ash/* with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review. Created 5 years, 1 month 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: ash/test/test_session_state_delegate.cc
diff --git a/ash/test/test_session_state_delegate.cc b/ash/test/test_session_state_delegate.cc
index bd0bdd37d41f82d795a8e96fd235fd952e5dd0ce..d7e8fbbc724cbe85f132df2596cc543419171b0f 100644
--- a/ash/test/test_session_state_delegate.cc
+++ b/ash/test/test_session_state_delegate.cc
@@ -21,11 +21,16 @@ namespace test {
namespace {
-// The the "canonicalized" Account ID from a given |email| address.
-AccountId GetAccountIdFromEmail(const std::string& email) {
+// Returns the "canonicalized" email from a given |email| address.
+std::string GetUserIdFromEmail(const std::string& email) {
std::string user_id = email;
std::transform(user_id.begin(), user_id.end(), user_id.begin(), ::tolower);
- return AccountId::FromUserEmail(user_id);
+ return user_id;
+}
+
+// Returns Account ID from a given |email| address.
+AccountId GetAccountIdFromEmail(const std::string& email) {
+ return AccountId::FromUserEmail(GetUserIdFromEmail(email));
}
} // namespace
@@ -101,8 +106,8 @@ TestSessionStateDelegate::~TestSessionStateDelegate() {
STLDeleteElements(&user_list_);
}
-void TestSessionStateDelegate::AddUser(const std::string& user_id) {
- user_list_.push_back(new MockUserInfo(user_id));
+void TestSessionStateDelegate::AddUser(const AccountId& account_id) {
+ user_list_.push_back(new MockUserInfo(account_id.GetUserEmail()));
}
const user_manager::UserInfo* TestSessionStateDelegate::GetActiveUserInfo()
@@ -216,10 +221,10 @@ gfx::ImageSkia TestSessionStateDelegate::GetAvatarImageForWindow(
return gfx::ImageSkia();
}
-void TestSessionStateDelegate::SwitchActiveUser(const std::string& user_id) {
- const AccountId account_id(GetAccountIdFromEmail(user_id));
+void TestSessionStateDelegate::SwitchActiveUser(const AccountId& account_id) {
// Make sure this is a user id and not an email address.
- EXPECT_EQ(user_id, account_id.GetUserEmail());
+ EXPECT_EQ(account_id.GetUserEmail(),
+ GetUserIdFromEmail(account_id.GetUserEmail()));
active_user_index_ = 0;
for (std::vector<MockUserInfo*>::iterator iter = user_list_.begin();
iter != user_list_.end();
@@ -233,7 +238,7 @@ void TestSessionStateDelegate::SwitchActiveUser(const std::string& user_id) {
}
void TestSessionStateDelegate::CycleActiveUser(CycleUser cycle_user) {
- SwitchActiveUser("someone@tray");
+ SwitchActiveUser(AccountId::FromUserEmail("someone@tray"));
}
bool TestSessionStateDelegate::IsMultiProfileAllowedByPrimaryUserPolicy()
« no previous file with comments | « ash/test/test_session_state_delegate.h ('k') | chrome/browser/chromeos/accessibility/accessibility_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698