Index: chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc |
diff --git a/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc b/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc |
index b3542385c31fcb2bf4a240b5ceee9568e3921106..e7e6e24d60c1123a1719f5de927241b56e8bc024 100644 |
--- a/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc |
+++ b/chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc |
@@ -39,6 +39,7 @@ |
#include "chrome/browser/chromeos/profiles/profile_helper.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/profiles/profile_downloader.h" |
+#include "chrome/browser/signin/account_tracker_service_factory.h" |
#include "chrome/common/chrome_paths.h" |
#include "chrome/test/base/in_process_browser_test.h" |
#include "chrome/test/base/testing_browser_process.h" |
@@ -216,6 +217,23 @@ class UserImageManagerTest : public LoginManagerTest, |
return user_data_dir_.Append(username).AddExtension(extension); |
} |
+ // Seeds the AccountTrackerService with test data so the ProfileDownloader can |
+ // retrieve the picture URL and fetch the image. |
+ void SeedAccountTrackerService(const std::string& username, |
+ Profile* profile) { |
+ AccountTrackerService::AccountInfo info; |
+ info.account_id = ""; |
Nikita (slow)
2015/05/14 18:44:22
nit: std::string()
anthonyvd
2015/05/15 19:46:10
Done.
|
+ info.gaia = username; |
+ info.email = username; |
+ info.full_name = username; |
+ info.given_name = username; |
+ info.hosted_domain = ""; |
Nikita (slow)
2015/05/14 18:44:22
nit: same here
anthonyvd
2015/05/15 19:46:10
Done.
|
+ info.locale = username; |
+ info.picture_url = "http://localhost/avatar.jpg"; |
+ |
+ AccountTrackerServiceFactory::GetForProfile(profile)->SeedAccountInfo(info); |
+ } |
+ |
// Completes the download of all non-image profile data for the user |
// |username|. This method must only be called after a profile data |
// download has been started. |url_fetcher_factory| will capture |
@@ -234,17 +252,6 @@ class UserImageManagerTest : public LoginManagerTest, |
OnGetTokenSuccess(NULL, |
std::string(), |
base::Time::Now() + base::TimeDelta::FromDays(1)); |
- |
- net::TestURLFetcher* fetcher = url_fetcher_factory->GetFetcherByID( |
- gaia::GaiaOAuthClient::kUrlFetcherId); |
- ASSERT_TRUE(fetcher); |
- fetcher->SetResponseString( |
- "{ \"picture\": \"http://localhost/avatar.jpg\" }"); |
- fetcher->set_status(net::URLRequestStatus(net::URLRequestStatus::SUCCESS, |
- net::OK)); |
- fetcher->set_response_code(200); |
- fetcher->delegate()->OnURLFetchComplete(fetcher); |
- base::RunLoop().RunUntilIdle(); |
} |
// Completes the download of the currently logged-in user's profile image. |
@@ -523,6 +530,8 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, SaveUserImageFromProfileImage) { |
UserImageManagerImpl::IgnoreProfileDataDownloadDelayForTesting(); |
LoginUser(kTestUser1); |
+ Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
+ SeedAccountTrackerService(kTestUser1, profile); |
run_loop_.reset(new base::RunLoop); |
UserImageManager* user_image_manager = |
@@ -574,6 +583,8 @@ IN_PROC_BROWSER_TEST_F(UserImageManagerTest, |
UserImageManagerImpl::IgnoreProfileDataDownloadDelayForTesting(); |
LoginUser(kTestUser1); |
+ Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
+ SeedAccountTrackerService(kTestUser1, profile); |
run_loop_.reset(new base::RunLoop); |
UserImageManager* user_image_manager = |