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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 EXPECT_TRUE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(index)); | 146 EXPECT_TRUE(GetCache()->GetHasMigratedToGAIAInfoOfProfileAtIndex(index)); |
147 EXPECT_EQ(old_name, GetCache()->GetNameOfProfileAtIndex(index)); | 147 EXPECT_EQ(old_name, GetCache()->GetNameOfProfileAtIndex(index)); |
148 EXPECT_EQ(new_name, GetCache()->GetGAIANameOfProfileAtIndex(index)); | 148 EXPECT_EQ(new_name, GetCache()->GetGAIANameOfProfileAtIndex(index)); |
149 EXPECT_TRUE(gfx::test::IsEqual( | 149 EXPECT_TRUE(gfx::test::IsEqual( |
150 old_image, GetCache()->GetAvatarIconOfProfileAtIndex(index))); | 150 old_image, GetCache()->GetAvatarIconOfProfileAtIndex(index))); |
151 EXPECT_TRUE(gfx::test::IsEqual( | 151 EXPECT_TRUE(gfx::test::IsEqual( |
152 new_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(index))); | 152 new_image, *GetCache()->GetGAIAPictureOfProfileAtIndex(index))); |
153 } | 153 } |
154 | 154 |
155 TEST_F(GAIAInfoUpdateServiceTest, ShouldUseGAIAProfileInfo) { | 155 TEST_F(GAIAInfoUpdateServiceTest, ShouldUseGAIAProfileInfo) { |
| 156 #if defined(OS_CHROMEOS) |
| 157 // This feature should never be enabled on ChromeOS. |
| 158 EXPECT_FALSE(GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile())); |
| 159 #else |
156 bool sync_enabled = profile()->GetOriginalProfile()->IsSyncAccessible(); | 160 bool sync_enabled = profile()->GetOriginalProfile()->IsSyncAccessible(); |
157 EXPECT_EQ(sync_enabled, | 161 EXPECT_EQ(sync_enabled, |
158 GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile())); | 162 GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile())); |
| 163 #endif |
159 } | 164 } |
160 | 165 |
161 TEST_F(GAIAInfoUpdateServiceTest, ScheduleUpdate) { | 166 TEST_F(GAIAInfoUpdateServiceTest, ScheduleUpdate) { |
162 GAIAInfoUpdateService service(profile()); | 167 GAIAInfoUpdateService service(profile()); |
163 EXPECT_TRUE(service.timer_.IsRunning()); | 168 EXPECT_TRUE(service.timer_.IsRunning()); |
164 service.timer_.Stop(); | 169 service.timer_.Stop(); |
165 EXPECT_FALSE(service.timer_.IsRunning()); | 170 EXPECT_FALSE(service.timer_.IsRunning()); |
166 service.ScheduleNextUpdate(); | 171 service.ScheduleNextUpdate(); |
167 EXPECT_TRUE(service.timer_.IsRunning()); | 172 EXPECT_TRUE(service.timer_.IsRunning()); |
168 } | 173 } |
(...skipping 17 matching lines...) Expand all Loading... |
186 | 191 |
187 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { | 192 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { |
188 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); | 193 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); |
189 GAIAInfoUpdateServiceMock service(profile()); | 194 GAIAInfoUpdateServiceMock service(profile()); |
190 | 195 |
191 // Log in. | 196 // Log in. |
192 EXPECT_CALL(service, Update()); | 197 EXPECT_CALL(service, Update()); |
193 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 198 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
194 "pat@example.com"); | 199 "pat@example.com"); |
195 } | 200 } |
OLD | NEW |