| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/common/thumbnail_score.h" | 5 #include "chrome/common/thumbnail_score.h" |
| 6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
| 7 | 7 |
| 8 // Tests that the different types of thumbnails are compared properly. | 8 // Tests that the different types of thumbnails are compared properly. |
| 9 TEST(ThumbnailScoreTest, ShouldReplaceThumbnailWithType) { | 9 TEST(ThumbnailScoreTest, ShouldReplaceThumbnailWithType) { |
| 10 base::Time now = base::Time::Now(); | 10 base::Time now = base::Time::Now(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 score.load_completed = true; | 75 score.load_completed = true; |
| 76 EXPECT_FALSE(score.ShouldConsiderUpdating()); | 76 EXPECT_FALSE(score.ShouldConsiderUpdating()); |
| 77 | 77 |
| 78 // Make it very boring, but it won't change the result. The boring score | 78 // Make it very boring, but it won't change the result. The boring score |
| 79 // isn't used for judging whether we should update or not. See comments | 79 // isn't used for judging whether we should update or not. See comments |
| 80 // at boring_score in thumbnail_score.h for why. | 80 // at boring_score in thumbnail_score.h for why. |
| 81 score.boring_score = 1.0; | 81 score.boring_score = 1.0; |
| 82 EXPECT_FALSE(score.ShouldConsiderUpdating()); | 82 EXPECT_FALSE(score.ShouldConsiderUpdating()); |
| 83 | 83 |
| 84 // Make it old. Then, it's no longer new enough. | 84 // Make it old. Then, it's no longer new enough. |
| 85 score.time_at_snapshot -= ThumbnailScore::kUpdateThumbnailTime; | 85 score.time_at_snapshot -= |
| 86 base::TimeDelta::FromDays(ThumbnailScore::kUpdateThumbnailTimeDays); |
| 86 EXPECT_TRUE(score.ShouldConsiderUpdating()); | 87 EXPECT_TRUE(score.ShouldConsiderUpdating()); |
| 87 } | 88 } |
| OLD | NEW |