Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Unified Diff: chrome/browser/chromeos/login/users/avatar/user_image_manager_browsertest.cc

Issue 1091363002: Change ProfileDownloader to use AccountTrackerService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_downloader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7d9893142ecb1fe83d42a5098e3741380ee6d9d6 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 = std::string();
+ info.gaia = username;
+ info.email = username;
+ info.full_name = username;
+ info.given_name = username;
+ info.hosted_domain = std::string();
+ 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 =
« no previous file with comments | « no previous file | chrome/browser/profiles/profile_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698