| 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 "chrome/browser/profiles/gaia_info_update_service.h" | 5 #include "chrome/browser/profiles/gaia_info_update_service.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/profiles/profile_downloader.h" | 10 #include "chrome/browser/profiles/profile_downloader.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 // No URL should be cached yet. | 110 // No URL should be cached yet. |
| 111 EXPECT_EQ(std::string(), service()->GetCachedPictureURL()); | 111 EXPECT_EQ(std::string(), service()->GetCachedPictureURL()); |
| 112 | 112 |
| 113 service()->OnProfileDownloadSuccess(downloader()); | 113 service()->OnProfileDownloadSuccess(downloader()); |
| 114 | 114 |
| 115 // On success both the profile info and GAIA info should be updated. | 115 // On success both the profile info and GAIA info should be updated. |
| 116 size_t index = GetCache()->GetIndexOfProfileWithPath(profile()->GetPath()); | 116 size_t index = GetCache()->GetIndexOfProfileWithPath(profile()->GetPath()); |
| 117 EXPECT_EQ(name, GetCache()->GetNameOfProfileAtIndex(index)); | 117 EXPECT_EQ(name, GetCache()->GetNameOfProfileAtIndex(index)); |
| 118 EXPECT_EQ(name, GetCache()->GetGAIANameOfProfileAtIndex(index)); | 118 EXPECT_EQ(name, GetCache()->GetGAIANameOfProfileAtIndex(index)); |
| 119 EXPECT_TRUE(gfx::test::IsEqual( | 119 EXPECT_TRUE(gfx::test::IsEqual( |
| 120 image, GetCache()->GetAvatarIconOfProfileAtIndex(index))); | |
| 121 EXPECT_TRUE(gfx::test::IsEqual( | |
| 122 image, *GetCache()->GetGAIAPictureOfProfileAtIndex(index))); | 120 image, *GetCache()->GetGAIAPictureOfProfileAtIndex(index))); |
| 123 EXPECT_EQ(url, service()->GetCachedPictureURL()); | 121 EXPECT_EQ(url, service()->GetCachedPictureURL()); |
| 124 } | 122 } |
| 125 | 123 |
| 126 TEST_F(GAIAInfoUpdateServiceTest, DownloadFailure) { | 124 TEST_F(GAIAInfoUpdateServiceTest, DownloadFailure) { |
| 127 size_t index = GetCache()->GetIndexOfProfileWithPath(profile()->GetPath()); | 125 size_t index = GetCache()->GetIndexOfProfileWithPath(profile()->GetPath()); |
| 128 base::string16 old_name = GetCache()->GetNameOfProfileAtIndex(index); | 126 base::string16 old_name = GetCache()->GetNameOfProfileAtIndex(index); |
| 129 gfx::Image old_image = GetCache()->GetAvatarIconOfProfileAtIndex(index); | 127 gfx::Image old_image = GetCache()->GetAvatarIconOfProfileAtIndex(index); |
| 130 | 128 |
| 131 EXPECT_EQ(std::string(), service()->GetCachedPictureURL()); | 129 EXPECT_EQ(std::string(), service()->GetCachedPictureURL()); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 182 |
| 185 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { | 183 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { |
| 186 // Log in. | 184 // Log in. |
| 187 EXPECT_CALL(*service(), Update()); | 185 EXPECT_CALL(*service(), Update()); |
| 188 SigninManager* signin_manager = | 186 SigninManager* signin_manager = |
| 189 SigninManagerFactory::GetForProfile(profile()); | 187 SigninManagerFactory::GetForProfile(profile()); |
| 190 signin_manager->OnExternalSigninCompleted("pat@example.com"); | 188 signin_manager->OnExternalSigninCompleted("pat@example.com"); |
| 191 } | 189 } |
| 192 | 190 |
| 193 #endif | 191 #endif |
| OLD | NEW |