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/utf_string_conversions.h" | 8 #include "base/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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 gfx::Image gaia_picture = gfx::test::CreateImage(); | 177 gfx::Image gaia_picture = gfx::test::CreateImage(); |
178 GetCache()->SetGAIAPictureOfProfileAtIndex(0, &gaia_picture); | 178 GetCache()->SetGAIAPictureOfProfileAtIndex(0, &gaia_picture); |
179 | 179 |
180 // Set a fake picture URL. | 180 // Set a fake picture URL. |
181 profile()->GetPrefs()->SetString(prefs::kProfileGAIAInfoPictureURL, | 181 profile()->GetPrefs()->SetString(prefs::kProfileGAIAInfoPictureURL, |
182 "example.com"); | 182 "example.com"); |
183 | 183 |
184 GAIAInfoUpdateService service(profile()); | 184 GAIAInfoUpdateService service(profile()); |
185 EXPECT_FALSE(service.GetCachedPictureURL().empty()); | 185 EXPECT_FALSE(service.GetCachedPictureURL().empty()); |
186 // Log out. | 186 // Log out. |
187 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); | 187 profile()->GetPrefs() |
| 188 ->SetString(prefs::kGoogleServicesUsername, std::string()); |
188 | 189 |
189 // Verify that the GAIA name and picture, and picture URL are unset. | 190 // Verify that the GAIA name and picture, and picture URL are unset. |
190 EXPECT_TRUE(GetCache()->GetGAIANameOfProfileAtIndex(0).empty()); | 191 EXPECT_TRUE(GetCache()->GetGAIANameOfProfileAtIndex(0).empty()); |
191 EXPECT_EQ(NULL, GetCache()->GetGAIAPictureOfProfileAtIndex(0)); | 192 EXPECT_EQ(NULL, GetCache()->GetGAIAPictureOfProfileAtIndex(0)); |
192 EXPECT_TRUE(service.GetCachedPictureURL().empty()); | 193 EXPECT_TRUE(service.GetCachedPictureURL().empty()); |
193 } | 194 } |
194 | 195 |
195 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { | 196 TEST_F(GAIAInfoUpdateServiceTest, LogIn) { |
196 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, ""); | 197 profile()->GetPrefs() |
| 198 ->SetString(prefs::kGoogleServicesUsername, std::string()); |
197 GAIAInfoUpdateServiceMock service(profile()); | 199 GAIAInfoUpdateServiceMock service(profile()); |
198 | 200 |
199 // Log in. | 201 // Log in. |
200 EXPECT_CALL(service, Update()); | 202 EXPECT_CALL(service, Update()); |
201 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 203 profile()->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
202 "pat@example.com"); | 204 "pat@example.com"); |
203 } | 205 } |
OLD | NEW |