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

Unified Diff: chrome/browser/history/thumbnail_database_unittest.cc

Issue 1100763002: Inject CanAddURLToHistory into TopSitesImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefs
Patch Set: Fix error introduced during rebase Created 5 years, 8 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/history/history_unittest.cc ('k') | chrome/browser/history/top_sites_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/thumbnail_database_unittest.cc
diff --git a/chrome/browser/history/thumbnail_database_unittest.cc b/chrome/browser/history/thumbnail_database_unittest.cc
index 9cca3cdd5685755c36f058de8b2cd225360ad81f..4b552d2372a86a4be2d96736ef50feb468841743 100644
--- a/chrome/browser/history/thumbnail_database_unittest.cc
+++ b/chrome/browser/history/thumbnail_database_unittest.cc
@@ -387,6 +387,31 @@ TEST_F(ThumbnailDatabaseTest, RetainDataForPageUrls) {
EXPECT_EQ(original_schema, db.db_.GetSchema());
}
+// Test that RetainDataForPageUrls() expires retained favicons.
+TEST_F(ThumbnailDatabaseTest, RetainDataForPageUrlsExpiresRetainedFavicons) {
+ ThumbnailDatabase db(NULL);
+ ASSERT_EQ(sql::INIT_OK, db.Init(file_name_));
+ db.BeginTransaction();
+
+ scoped_refptr<base::RefCountedStaticMemory> favicon1(
+ new base::RefCountedStaticMemory(kBlob1, sizeof(kBlob1)));
+ favicon_base::FaviconID kept_id = db.AddFavicon(
+ kIconUrl1, favicon_base::FAVICON, favicon1, base::Time::Now(),
+ gfx::Size());
+ db.AddIconMapping(kPageUrl1, kept_id);
+
+ EXPECT_TRUE(db.RetainDataForPageUrls(std::vector<GURL>(1u, kPageUrl1)));
+
+ favicon_base::FaviconID new_favicon_id = db.GetFaviconIDForFaviconURL(
+ kIconUrl1, favicon_base::FAVICON, nullptr);
+ ASSERT_NE(0, new_favicon_id);
+ std::vector<FaviconBitmap> new_favicon_bitmaps;
+ db.GetFaviconBitmaps(new_favicon_id, &new_favicon_bitmaps);
+
+ ASSERT_EQ(1u, new_favicon_bitmaps.size());
+ EXPECT_EQ(0, new_favicon_bitmaps[0].last_updated.ToInternalValue());
+}
+
// Tests that deleting a favicon deletes the favicon row and favicon bitmap
// rows from the database.
TEST_F(ThumbnailDatabaseTest, DeleteFavicon) {
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/browser/history/top_sites_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698