| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/history/visit_filter.h" | 5 #include "chrome/browser/history/visit_filter.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 namespace history { | 24 namespace history { |
| 25 | 25 |
| 26 class VisitFilterTest : public testing::Test { | 26 class VisitFilterTest : public testing::Test { |
| 27 public: | 27 public: |
| 28 VisitFilterTest(); | 28 VisitFilterTest(); |
| 29 | 29 |
| 30 protected: | 30 protected: |
| 31 void SetUp(); | 31 virtual void SetUp(); |
| 32 void TearDown(); | 32 virtual void TearDown(); |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 VisitFilterTest::VisitFilterTest() { | 35 VisitFilterTest::VisitFilterTest() { |
| 36 } | 36 } |
| 37 | 37 |
| 38 void VisitFilterTest::SetUp() { | 38 void VisitFilterTest::SetUp() { |
| 39 } | 39 } |
| 40 | 40 |
| 41 void VisitFilterTest::TearDown() { | 41 void VisitFilterTest::TearDown() { |
| 42 } | 42 } |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 visit.visit_time = filter_time - base::TimeDelta::FromDays(7); | 305 visit.visit_time = filter_time - base::TimeDelta::FromDays(7); |
| 306 EXPECT_DOUBLE_EQ(0.5, filter.GetVisitScore(visit)); | 306 EXPECT_DOUBLE_EQ(0.5, filter.GetVisitScore(visit)); |
| 307 // One standard deviation of decay, plus the staleness factor. | 307 // One standard deviation of decay, plus the staleness factor. |
| 308 visit.visit_time = filter_time - base::TimeDelta::FromDays(7) - | 308 visit.visit_time = filter_time - base::TimeDelta::FromDays(7) - |
| 309 base::TimeDelta::FromHours(1); | 309 base::TimeDelta::FromHours(1); |
| 310 EXPECT_DOUBLE_EQ(exp(-0.5) * one_week_one_hour_staleness, | 310 EXPECT_DOUBLE_EQ(exp(-0.5) * one_week_one_hour_staleness, |
| 311 filter.GetVisitScore(visit)); | 311 filter.GetVisitScore(visit)); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace history | 314 } // namespace history |
| OLD | NEW |