diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-05 22:33:17 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-05 22:33:17 +0000 |
commit | ff2dd6098ad664d4eae82cf334b3a872b576f18b (patch) | |
tree | 7634e868dc5fe03a7f0d4c37e73cc64a0ad3ee33 /chrome | |
parent | a5f1862072501b117530546e9e9bb5c1f70eb049 (diff) | |
download | chromium_src-ff2dd6098ad664d4eae82cf334b3a872b576f18b.zip chromium_src-ff2dd6098ad664d4eae82cf334b3a872b576f18b.tar.gz chromium_src-ff2dd6098ad664d4eae82cf334b3a872b576f18b.tar.bz2 |
Update thumbnail_database to store times using ToInternalValue().
Modify ThumbnailScore::Equals() to test whether the time_at_snapshot match exactly.
BUG=None
Test=ThumbnailDatabaseTest.* ThumbnailScoreTest.* pass
Review URL: https://chromiumcodereview.appspot.com/10915092
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/history/thumbnail_database.cc | 8 | ||||
-rw-r--r-- | chrome/browser/history/thumbnail_database_unittest.cc | 8 | ||||
-rw-r--r-- | chrome/common/thumbnail_score.cc | 5 |
3 files changed, 10 insertions, 11 deletions
diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc index 8235089..d0ef182 100644 --- a/chrome/browser/history/thumbnail_database.cc +++ b/chrome/browser/history/thumbnail_database.cc @@ -373,7 +373,7 @@ bool ThumbnailDatabase::SetPageThumbnail( statement.BindDouble(1, score.boring_score); statement.BindBool(2, score.good_clipping); statement.BindBool(3, score.at_top); - statement.BindInt64(4, score.time_at_snapshot.ToTimeT()); + statement.BindInt64(4, score.time_at_snapshot.ToInternalValue()); statement.BindBlob(5, &jpeg_data[0], static_cast<int>(jpeg_data.size())); @@ -441,7 +441,7 @@ bool ThumbnailDatabase::ThumbnailScoreForId(URLID id, bool current_clipping = select_statement.ColumnBool(1); bool current_at_top = select_statement.ColumnBool(2); base::Time last_updated = - base::Time::FromTimeT(select_statement.ColumnInt64(3)); + base::Time::FromInternalValue(select_statement.ColumnInt64(3)); *score = ThumbnailScore(current_boring_score, current_clipping, current_at_top, last_updated); return true; @@ -466,7 +466,7 @@ bool ThumbnailDatabase::GetFaviconBitmaps( favicon_bitmap.bitmap_id = statement.ColumnInt64(0); favicon_bitmap.icon_id = icon_id; favicon_bitmap.last_updated = - base::Time::FromTimeT(statement.ColumnInt64(1)); + base::Time::FromInternalValue(statement.ColumnInt64(1)); if (statement.ColumnByteLength(2) > 0) { scoped_refptr<base::RefCountedBytes> data(new base::RefCountedBytes()); statement.ColumnBlobAsVector(2, &data->data()); @@ -495,7 +495,7 @@ FaviconBitmapID ThumbnailDatabase::AddFaviconBitmap( } else { statement.BindNull(1); } - statement.BindInt64(2, time.ToTimeT()); + statement.BindInt64(2, time.ToInternalValue()); statement.BindInt(3, pixel_size.width()); statement.BindInt(4, pixel_size.height()); diff --git a/chrome/browser/history/thumbnail_database_unittest.cc b/chrome/browser/history/thumbnail_database_unittest.cc index 0c55e5e..7aab0a9 100644 --- a/chrome/browser/history/thumbnail_database_unittest.cc +++ b/chrome/browser/history/thumbnail_database_unittest.cc @@ -167,7 +167,8 @@ TEST_F(ThumbnailDatabaseTest, GetFaviconAfterMigrationToTopSites) { EXPECT_EQ(bitmap1_id, favicon_bitmap1.bitmap_id); EXPECT_EQ(icon_id, favicon_bitmap1.icon_id); - EXPECT_EQ(time.ToTimeT(), favicon_bitmap1.last_updated.ToTimeT()); + EXPECT_EQ(time.ToInternalValue(), + favicon_bitmap1.last_updated.ToInternalValue()); EXPECT_EQ(data.size(), favicon_bitmap1.bitmap_data->size()); EXPECT_TRUE(std::equal(data.begin(), data.end(), @@ -176,7 +177,8 @@ TEST_F(ThumbnailDatabaseTest, GetFaviconAfterMigrationToTopSites) { EXPECT_EQ(bitmap2_id, favicon_bitmap2.bitmap_id); EXPECT_EQ(icon_id, favicon_bitmap2.icon_id); - EXPECT_EQ(time.ToTimeT(), favicon_bitmap2.last_updated.ToTimeT()); + EXPECT_EQ(time.ToInternalValue(), + favicon_bitmap2.last_updated.ToInternalValue()); EXPECT_EQ(data.size(), favicon_bitmap2.bitmap_data->size()); EXPECT_TRUE(std::equal(data.begin(), data.end(), @@ -392,7 +394,7 @@ TEST_F(ThumbnailDatabaseTest, UpgradeToVersion6) { int favicon_id = 1; GURL url("http://google.com"); - time_t last_updated = Time::Now().ToTimeT(); + int64 last_updated = Time::Now().ToInternalValue(); std::vector<unsigned char> data(blob1, blob1 + sizeof(blob1)); scoped_refptr<base::RefCountedBytes> bitmap_data( new base::RefCountedBytes(data)); diff --git a/chrome/common/thumbnail_score.cc b/chrome/common/thumbnail_score.cc index bff3e35..e2f41a0 100644 --- a/chrome/common/thumbnail_score.cc +++ b/chrome/common/thumbnail_score.cc @@ -62,13 +62,10 @@ ThumbnailScore::~ThumbnailScore() { } bool ThumbnailScore::Equals(const ThumbnailScore& rhs) const { - // When testing equality we use ToTimeT() because that's the value - // stuck in the SQL database, so we need to test equivalence with - // that lower resolution. return boring_score == rhs.boring_score && good_clipping == rhs.good_clipping && at_top == rhs.at_top && - time_at_snapshot.ToTimeT() == rhs.time_at_snapshot.ToTimeT() && + time_at_snapshot == rhs.time_at_snapshot && redirect_hops_from_dest == rhs.redirect_hops_from_dest; } |