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 "components/history/core/browser/visit_filter.h" | 5 #include "components/history/core/browser/visit_filter.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stddef.h> |
8 | 9 |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
11 #include "components/history/core/browser/history_types.h" | 12 #include "components/history/core/browser/history_types.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // So the tests won't go into the other day +/- several hours, return midday of | 17 // So the tests won't go into the other day +/- several hours, return midday of |
17 // today. | 18 // today. |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 visit.visit_time = filter_time - base::TimeDelta::FromDays(7); | 306 visit.visit_time = filter_time - base::TimeDelta::FromDays(7); |
306 EXPECT_DOUBLE_EQ(0.5, filter.GetVisitScore(visit)); | 307 EXPECT_DOUBLE_EQ(0.5, filter.GetVisitScore(visit)); |
307 // One standard deviation of decay, plus the staleness factor. | 308 // One standard deviation of decay, plus the staleness factor. |
308 visit.visit_time = filter_time - base::TimeDelta::FromDays(7) - | 309 visit.visit_time = filter_time - base::TimeDelta::FromDays(7) - |
309 base::TimeDelta::FromHours(1); | 310 base::TimeDelta::FromHours(1); |
310 EXPECT_DOUBLE_EQ(exp(-0.5) * one_week_one_hour_staleness, | 311 EXPECT_DOUBLE_EQ(exp(-0.5) * one_week_one_hour_staleness, |
311 filter.GetVisitScore(visit)); | 312 filter.GetVisitScore(visit)); |
312 } | 313 } |
313 | 314 |
314 } // namespace history | 315 } // namespace history |
OLD | NEW |