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

Unified Diff: chrome/browser/profiles/profile_info_cache_unittest.cc

Issue 380643002: Profile picture doesn't display correctly after new profile has been created (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated patch Created 6 years, 5 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 | « chrome/browser/profiles/profile_info_cache.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_info_cache_unittest.cc
diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc
index 997439870c23dfea82eab65457512357a721909b..bc8b1dad522f9718d5fb68c561b6e18410efd15f 100644
--- a/chrome/browser/profiles/profile_info_cache_unittest.cc
+++ b/chrome/browser/profiles/profile_info_cache_unittest.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "base/command_line.h"
#include "base/file_util.h"
#include "base/prefs/testing_pref_service.h"
#include "base/strings/stringprintf.h"
@@ -18,7 +19,9 @@
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_info_cache.h"
#include "chrome/browser/profiles/profile_manager.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/testing_browser_process.h"
+#include "components/signin/core/common/profile_management_switches.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/notification_service.h"
@@ -505,6 +508,8 @@ TEST_F(ProfileInfoCacheTest, AddStubProfile) {
}
TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(switches::kNewAvatarMenu);
+
EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles());
base::FilePath path_1 = GetProfilePath("path_1");
GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"),
@@ -513,7 +518,12 @@ TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) {
// We haven't downloaded any high-res avatars yet.
EXPECT_EQ(0U, GetCache()->cached_avatar_images_.size());
- EXPECT_EQ(0U, GetCache()->avatar_images_downloads_in_progress_.size());
+
+ // After adding a new profile, the download of high-res avatar will be
+ // triggered if the flag kNewAvatarMenu has been set. But the downloader
+ // won't ever call OnFetchComplete in the test.
+ EXPECT_EQ(1U, GetCache()->avatar_images_downloads_in_progress_.size());
+
EXPECT_FALSE(GetCache()->GetHighResAvatarOfProfileAtIndex(0));
// Simulate downloading a high-res avatar.
@@ -533,7 +543,7 @@ TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) {
profiles::GetDefaultAvatarIconFileNameAtIndex(kIconIndex);
// The file should have been cached and saved.
- EXPECT_EQ(0U, GetCache()->avatar_images_downloads_in_progress_.size());
+ EXPECT_EQ(1U, GetCache()->avatar_images_downloads_in_progress_.size());
EXPECT_EQ(1U, GetCache()->cached_avatar_images_.size());
EXPECT_TRUE(GetCache()->GetHighResAvatarOfProfileAtIndex(0));
EXPECT_EQ(GetCache()->cached_avatar_images_[file_name],
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698