Chromium Code Reviews| 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 7f2e648d3796a15a18fddb4747b84919cf47ce81..09daf2ed037ea59565b589311a208f80c92dd0a2 100644 |
| --- a/ash/test/test_session_state_delegate.cc |
| +++ b/ash/test/test_session_state_delegate.cc |
| @@ -12,6 +12,7 @@ |
| #include "base/stl_util.h" |
| #include "base/strings/string16.h" |
| #include "base/strings/utf_string_conversions.h" |
| +#include "components/signin/core/account_id/account_id.h" |
| #include "components/user_manager/user_info.h" |
| #include "testing/gtest/include/gtest/gtest.h" |
| @@ -21,17 +22,19 @@ namespace test { |
| namespace { |
| // The the "canonicalized" user ID from a given |email| address. |
| -std::string GetUserIDFromEmail(const std::string& email) { |
| +AccountId GetUserIDFromEmail(const std::string& email) { |
| std::string user_id = email; |
| std::transform(user_id.begin(), user_id.end(), user_id.begin(), ::tolower); |
| - return user_id; |
| + return AccountId::FromUserEmail(user_id); |
| } |
| } // namespace |
| class MockUserInfo : public user_manager::UserInfo { |
| public: |
| - explicit MockUserInfo(const std::string& id) : email_(id) {} |
| + explicit MockUserInfo(const std::string& display_email) |
| + : display_email_(display_email), |
| + account_(GetUserIDFromEmail(display_email)) {} |
| ~MockUserInfo() override {} |
| void SetUserImage(const gfx::ImageSkia& user_image) { |
| @@ -46,18 +49,17 @@ class MockUserInfo : public user_manager::UserInfo { |
| return base::UTF8ToUTF16("Über Über Über Über"); |
| } |
| - std::string GetEmail() const override { return email_; } |
| + std::string GetEmail() const override { return display_email_; } |
| - std::string GetUserID() const override { |
| - return GetUserIDFromEmail(GetEmail()); |
| - } |
| + AccountId GetUserID() const override { return account_; } |
| const gfx::ImageSkia& GetImage() const override { return user_image_; } |
| // A test user image. |
| gfx::ImageSkia user_image_; |
| - std::string email_; |
| + std::string display_email_; |
| + AccountId account_; |
| DISALLOW_COPY_AND_ASSIGN(MockUserInfo); |
| }; |
| @@ -214,9 +216,11 @@ gfx::ImageSkia TestSessionStateDelegate::GetAvatarImageForWindow( |
| return gfx::ImageSkia(); |
| } |
| -void TestSessionStateDelegate::SwitchActiveUser(const std::string& user_id) { |
| +void TestSessionStateDelegate::SwitchActiveUser( |
| + const std::string& user_id_str) { |
| + const AccountId user_id(GetUserIDFromEmail(user_id_str)); |
|
achuithb
2015/10/23 00:08:49
account_id?
Alexander Alekseev
2015/10/23 09:11:20
Done.
|
| // Make sure this is a user id and not an email address. |
| - EXPECT_EQ(user_id, GetUserIDFromEmail(user_id)); |
| + EXPECT_EQ(user_id_str, user_id.GetUserEmail()); |
| active_user_index_ = 0; |
| for (std::vector<MockUserInfo*>::iterator iter = user_list_.begin(); |
| iter != user_list_.end(); |
| @@ -226,7 +230,7 @@ void TestSessionStateDelegate::SwitchActiveUser(const std::string& user_id) { |
| return; |
| } |
| } |
| - NOTREACHED() << "Unknown user:" << user_id; |
| + NOTREACHED() << "Unknown user:" << user_id.GetUserEmail(); |
| } |
| void TestSessionStateDelegate::CycleActiveUser(CycleUser cycle_user) { |