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

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

Issue 1020863007: Revert of Change default code flag to NewAvatarMenu. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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') | chrome/browser/profiles/profile_info_interface.h » ('j') | 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 c2171e1fd72101e476e8103b4ebe83902751af75..feb143a53eb293728b756495d74e292de5e58d2f 100644
--- a/chrome/browser/profiles/profile_info_cache_unittest.cc
+++ b/chrome/browser/profiles/profile_info_cache_unittest.cc
@@ -122,11 +122,6 @@
TEST_F(ProfileInfoCacheTest, AddProfiles) {
EXPECT_EQ(0u, GetCache()->GetNumberOfProfiles());
- // A bitmap for the high res avatar cache. Icon-sized bitmap of green pixels.
- SkBitmap bitmap;
- bitmap.allocN32Pixels(38, 31);
- bitmap.eraseColor(SK_ColorGREEN);
-
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
for (uint32 i = 0; i < 4; ++i) {
base::FilePath profile_path =
@@ -147,12 +142,6 @@
EXPECT_EQ(i + 1, GetCache()->GetNumberOfProfiles());
EXPECT_EQ(profile_name, GetCache()->GetNameOfProfileAtIndex(i));
EXPECT_EQ(profile_path, GetCache()->GetPathOfProfileAtIndex(i));
-
- ProfileAvatarDownloader avatar_downloader(
- GetCache()->GetAvatarIconIndexOfProfileAtIndex(i),
- profile_path, GetCache());
- avatar_downloader.OnFetchComplete(
- GURL("http://www.google.com/avatar.png"), &bitmap);
const SkBitmap* actual_icon =
GetCache()->GetAvatarIconOfProfileAtIndex(i).ToSkBitmap();
EXPECT_EQ(icon->width(), actual_icon->width());
@@ -557,39 +546,27 @@
switches::EnableNewAvatarMenuForTesting(
base::CommandLine::ForCurrentProcess());
- // The TestingProfileManager's ProfileInfoCache auto-downloads avatars.
- ProfileInfoCache profile_info_cache(g_browser_process->local_state(),
- testing_profile_manager_.profile_manager()->user_data_dir());
-
- // // Make sure there are no avatars already on disk.
- const size_t kIconIndex = 0;
- base::FilePath icon_path =
- profiles::GetPathOfHighResAvatarAtIndex(kIconIndex);
- EXPECT_TRUE(base::PathExists(icon_path));
- EXPECT_TRUE(base::DeleteFile(icon_path, true));
- EXPECT_FALSE(base::PathExists(icon_path));
-
- EXPECT_EQ(0U, profile_info_cache.GetNumberOfProfiles());
+ EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles());
base::FilePath path_1 = GetProfilePath("path_1");
- profile_info_cache.AddProfileToCache(path_1, ASCIIToUTF16("name_1"),
- base::string16(), kIconIndex, std::string());
- EXPECT_EQ(1U, profile_info_cache.GetNumberOfProfiles());
+ GetCache()->AddProfileToCache(path_1, ASCIIToUTF16("name_1"),
+ base::string16(), 0, std::string());
+ EXPECT_EQ(1U, GetCache()->GetNumberOfProfiles());
base::RunLoop().RunUntilIdle();
// We haven't downloaded any high-res avatars yet.
- EXPECT_EQ(0U, profile_info_cache.cached_avatar_images_.size());
+ EXPECT_EQ(0U, GetCache()->cached_avatar_images_.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, profile_info_cache.avatar_images_downloads_in_progress_.size());
-
- EXPECT_FALSE(profile_info_cache.GetHighResAvatarOfProfileAtIndex(0));
+ EXPECT_EQ(1U, GetCache()->avatar_images_downloads_in_progress_.size());
+
+ EXPECT_FALSE(GetCache()->GetHighResAvatarOfProfileAtIndex(0));
// Simulate downloading a high-res avatar.
+ const size_t kIconIndex = 0;
ProfileAvatarDownloader avatar_downloader(
- kIconIndex, profile_info_cache.GetPathOfProfileAtIndex(0),
- &profile_info_cache);
+ kIconIndex, GetCache()->GetPathOfProfileAtIndex(0), GetCache());
// Put a real bitmap into "bitmap". 2x2 bitmap of green 32 bit pixels.
SkBitmap bitmap;
@@ -600,21 +577,23 @@
GURL("http://www.google.com/avatar.png"), &bitmap);
// Now the download should not be in progress anymore.
- EXPECT_EQ(0U, profile_info_cache.avatar_images_downloads_in_progress_.size());
+ EXPECT_EQ(0U, GetCache()->avatar_images_downloads_in_progress_.size());
std::string file_name =
profiles::GetDefaultAvatarIconFileNameAtIndex(kIconIndex);
// The file should have been cached and saved.
- EXPECT_EQ(1U, profile_info_cache.cached_avatar_images_.size());
- EXPECT_TRUE(profile_info_cache.GetHighResAvatarOfProfileAtIndex(0));
- EXPECT_EQ(profile_info_cache.cached_avatar_images_[file_name],
- profile_info_cache.GetHighResAvatarOfProfileAtIndex(0));
+ EXPECT_EQ(1U, GetCache()->cached_avatar_images_.size());
+ EXPECT_TRUE(GetCache()->GetHighResAvatarOfProfileAtIndex(0));
+ EXPECT_EQ(GetCache()->cached_avatar_images_[file_name],
+ GetCache()->GetHighResAvatarOfProfileAtIndex(0));
// Make sure everything has completed, and the file has been written to disk.
base::RunLoop().RunUntilIdle();
// Clean up.
+ base::FilePath icon_path =
+ profiles::GetPathOfHighResAvatarAtIndex(kIconIndex);
EXPECT_NE(std::string::npos, icon_path.MaybeAsASCII().find(file_name));
EXPECT_TRUE(base::PathExists(icon_path));
EXPECT_TRUE(base::DeleteFile(icon_path, true));
« no previous file with comments | « chrome/browser/profiles/profile_info_cache.cc ('k') | chrome/browser/profiles/profile_info_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698