| Index: chrome/common/thumbnail_score_unittest.cc
|
| diff --git a/chrome/common/thumbnail_score_unittest.cc b/chrome/common/thumbnail_score_unittest.cc
|
| index 14d79dd9d7af9081608bb21eef19ead3de526b38..43cb96a57fccb0dc85e77a226cea26ea116ed3d4 100644
|
| --- a/chrome/common/thumbnail_score_unittest.cc
|
| +++ b/chrome/common/thumbnail_score_unittest.cc
|
| @@ -52,3 +52,27 @@ TEST(ThumbnailScoreTest, RedirectCount) {
|
| lotsa_redirects.redirect_hops_from_dest = 4;
|
| EXPECT_FALSE(ShouldReplaceThumbnailWith(no_redirects, lotsa_redirects));
|
| }
|
| +
|
| +TEST(ThumbnailScoreTest, ShouldGenerateThumbnail) {
|
| + ThumbnailScore score;
|
| + // By default, the score is 1.0, meaning very boring, thus we should
|
| + // generate a new thumbnail.
|
| + EXPECT_DOUBLE_EQ(1.0, score.boring_score);
|
| + EXPECT_TRUE(ShouldGenerateThumbnail(score));
|
| +
|
| + // Make it very interesting, but this is not enough.
|
| + score.boring_score = 0.0;
|
| + EXPECT_TRUE(ShouldGenerateThumbnail(score));
|
| +
|
| + // good_clipping is important, but sill not enough.
|
| + score.good_clipping = true;
|
| + EXPECT_TRUE(ShouldGenerateThumbnail(score));
|
| +
|
| + // at_top is important. Finally, the thumbnail is new and interesting enough.
|
| + score.at_top = true;
|
| + EXPECT_FALSE(ShouldGenerateThumbnail(score));
|
| +
|
| + // Make it old. Then, it's no longer new enough.
|
| + score.time_at_snapshot -= ThumbnailScore::kUpdateThumbnailTime;
|
| + EXPECT_TRUE(ShouldGenerateThumbnail(score));
|
| +}
|
|
|