OLD | NEW |
1 // Copyright (c) 2011 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/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" |
11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) | 156 #if defined(OS_CHROMEOS) |
157 // This feature should never be enabled on ChromeOS. | 157 // This feature should never be enabled on ChromeOS. |
158 EXPECT_FALSE(GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile())); | 158 EXPECT_FALSE(GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile())); |
159 #else | |
160 bool sync_enabled = profile()->GetOriginalProfile()->IsSyncAccessible(); | |
161 EXPECT_EQ(sync_enabled, | |
162 GAIAInfoUpdateService::ShouldUseGAIAProfileInfo(profile())); | |
163 #endif | 159 #endif |
164 } | 160 } |
165 | 161 |
166 TEST_F(GAIAInfoUpdateServiceTest, ScheduleUpdate) { | 162 TEST_F(GAIAInfoUpdateServiceTest, ScheduleUpdate) { |
167 GAIAInfoUpdateService service(profile()); | 163 GAIAInfoUpdateService service(profile()); |
168 EXPECT_TRUE(service.timer_.IsRunning()); | 164 EXPECT_TRUE(service.timer_.IsRunning()); |
169 service.timer_.Stop(); | 165 service.timer_.Stop(); |
170 EXPECT_FALSE(service.timer_.IsRunning()); | 166 EXPECT_FALSE(service.timer_.IsRunning()); |
171 service.ScheduleNextUpdate(); | 167 service.ScheduleNextUpdate(); |
172 EXPECT_TRUE(service.timer_.IsRunning()); | 168 EXPECT_TRUE(service.timer_.IsRunning()); |
(...skipping 24 matching lines...) Expand all Loading... |
197 | 193 |
198 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { | 194 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { |
199 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); | 195 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); |
200 GAIAInfoUpdateServiceMock service(profile()); | 196 GAIAInfoUpdateServiceMock service(profile()); |
201 | 197 |
202 // Log in. | 198 // Log in. |
203 EXPECT_CALL(service, Update()); | 199 EXPECT_CALL(service, Update()); |
204 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 200 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
205 "pat@example.com"); | 201 "pat@example.com"); |
206 } | 202 } |
OLD | NEW |