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

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

Issue 10802066: Adds support for saving favicon size into history database. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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
Index: chrome/browser/history/expire_history_backend_unittest.cc
diff --git a/chrome/browser/history/expire_history_backend_unittest.cc b/chrome/browser/history/expire_history_backend_unittest.cc
index 2cf7385c1a0cf088991c361a461d6d10ffda9f05..e9357c1e20769eb0d4c512ed6c8345fb8c96ef19 100644
--- a/chrome/browser/history/expire_history_backend_unittest.cc
+++ b/chrome/browser/history/expire_history_backend_unittest.cc
@@ -32,6 +32,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/gfx/codec/jpeg_codec.h"
+#include "ui/gfx/favicon_size.h"
using base::Time;
using base::TimeDelta;
@@ -45,6 +46,9 @@ static const FilePath::CharType kArchivedHistoryFile[] =
static const FilePath::CharType kThumbnailFile[] =
FILE_PATH_LITERAL("Thumbnails");
+static const gfx::Size kFaviconRegularSize =
+ gfx::Size(gfx::kFaviconSize, gfx::kFaviconSize);
+
// The test must be in the history namespace for the gtest forward declarations
// to work. It also eliminates a bunch of ugly "history::".
namespace history {
@@ -205,9 +209,9 @@ void ExpireHistoryTest::AddExampleData(URLID url_ids[3], Time visit_times[4]) {
// Two favicons. The first two URLs will share the same one, while the last
// one will have a unique favicon.
FaviconID favicon1 = thumb_db_->AddFavicon(GURL("http://favicon/url1"),
- FAVICON);
+ kFaviconRegularSize, FAVICON);
FaviconID favicon2 = thumb_db_->AddFavicon(GURL("http://favicon/url2"),
- FAVICON);
+ kFaviconRegularSize, FAVICON);
// Three URLs.
URLRow url_row1(GURL("http://www.google.com/1"));
@@ -323,14 +327,18 @@ bool ExpireHistoryTest::HasFavicon(FaviconID favicon_id) {
std::vector<unsigned char> icon_data_unused;
GURL icon_url;
return thumb_db_->GetFavicon(favicon_id, &last_updated, &icon_data_unused,
- &icon_url, NULL);
+ &icon_url, NULL, NULL);
}
FaviconID ExpireHistoryTest::GetFavicon(const GURL& page_url,
IconType icon_type) {
- IconMapping icon_mapping;
- thumb_db_->GetIconMappingForPageURL(page_url, icon_type, &icon_mapping);
- return icon_mapping.icon_id;
+ std::vector<IconMapping> icon_mappings;
+ thumb_db_->GetIconMappingsForPageURL(page_url, icon_type, &icon_mappings);
+
+ if (icon_mappings.empty())
+ return 0;
+
+ return icon_mappings[0].icon_id;
}
bool ExpireHistoryTest::HasThumbnail(URLID url_id) {
@@ -404,7 +412,8 @@ void ExpireHistoryTest::EnsureURLInfoGone(const URLRow& row) {
TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) {
// Add a favicon record.
const GURL favicon_url("http://www.google.com/favicon.ico");
- FaviconID icon_id = thumb_db_->AddFavicon(favicon_url, FAVICON);
+ FaviconID icon_id = thumb_db_->AddFavicon(favicon_url, kFaviconRegularSize,
+ FAVICON);
EXPECT_TRUE(icon_id);
EXPECT_TRUE(HasFavicon(icon_id));
@@ -415,7 +424,8 @@ TEST_F(ExpireHistoryTest, DeleteFaviconsIfPossible) {
EXPECT_FALSE(HasFavicon(icon_id));
// Add back the favicon.
- icon_id = thumb_db_->AddFavicon(favicon_url, TOUCH_ICON);
+ icon_id = thumb_db_->AddFavicon(favicon_url, kFaviconRegularSize,
+ TOUCH_ICON);
EXPECT_TRUE(icon_id);
EXPECT_TRUE(HasFavicon(icon_id));

Powered by Google App Engine
This is Rietveld 408576698