| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache_unittest.h" | 10 #include "chrome/browser/profiles/profile_info_cache_unittest.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 EXPECT_TRUE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(index)); | 130 EXPECT_TRUE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(index)); |
| 131 EXPECT_EQ(old_name, GetCache()->GetNameOfProfileAtIndex(index)); | 131 EXPECT_EQ(old_name, GetCache()->GetNameOfProfileAtIndex(index)); |
| 132 EXPECT_EQ(new_name, GetCache()->GetGAIANameOfProfileAtIndex(index)); | 132 EXPECT_EQ(new_name, GetCache()->GetGAIANameOfProfileAtIndex(index)); |
| 133 EXPECT_TRUE(gfx::test::IsEqual( | 133 EXPECT_TRUE(gfx::test::IsEqual( |
| 134 old_image, GetCache()->GetAvatarIconOfProfileAtIndex(index))); | 134 old_image, GetCache()->GetAvatarIconOfProfileAtIndex(index))); |
| 135 EXPECT_TRUE(gfx::test::IsEqual( | 135 EXPECT_TRUE(gfx::test::IsEqual( |
| 136 new_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(index))); | 136 new_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(index))); |
| 137 } | 137 } |
| 138 | 138 |
| 139 TEST_F(GAIAInfoUpdateServiceTest, ShouldUseGAIAProfileInfo) { | 139 TEST_F(GAIAInfoUpdateServiceTest, ShouldUseGAIAProfileInfo) { |
| 140 // Currently this is disabled by default. | 140 bool sync_enabled = profile()->GetOriginalProfile()->IsSyncAccessible(); |
| 141 EXPECT_FALSE(GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile())); | 141 EXPECT_EQ(sync_enabled, |
| 142 GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile())); |
| 142 } | 143 } |
| 143 | 144 |
| 144 TEST_F(GAIAInfoUpdateServiceTest, ScheduleUpdate) { | 145 TEST_F(GAIAInfoUpdateServiceTest, ScheduleUpdate) { |
| 145 GAIAInfoUpdateService service(profile()); | 146 GAIAInfoUpdateService service(profile()); |
| 146 EXPECT_TRUE(service.timer_.IsRunning()); | 147 EXPECT_TRUE(service.timer_.IsRunning()); |
| 147 service.timer_.Stop(); | 148 service.timer_.Stop(); |
| 148 EXPECT_FALSE(service.timer_.IsRunning()); | 149 EXPECT_FALSE(service.timer_.IsRunning()); |
| 149 service.ScheduleNextUpdate(); | 150 service.ScheduleNextUpdate(); |
| 150 EXPECT_TRUE(service.timer_.IsRunning()); | 151 EXPECT_TRUE(service.timer_.IsRunning()); |
| 151 } | 152 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 169 | 170 |
| 170 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { | 171 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { |
| 171 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); | 172 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); |
| 172 GAIAInfoUpdateServiceMock service(profile()); | 173 GAIAInfoUpdateServiceMock service(profile()); |
| 173 | 174 |
| 174 // Log in. | 175 // Log in. |
| 175 EXPECT_CALL(service, Update()); | 176 EXPECT_CALL(service, Update()); |
| 176 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 177 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
| 177 "pat@example.com"); | 178 "pat@example.com"); |
| 178 } | 179 } |
| OLD | NEW |