OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/engagement/site_engagement_service.h" | 5 #include "chrome/browser/engagement/site_engagement_service.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 exploded_reference_time.minute = 0; | 85 exploded_reference_time.minute = 0; |
86 exploded_reference_time.second = 0; | 86 exploded_reference_time.second = 0; |
87 exploded_reference_time.millisecond = 0; | 87 exploded_reference_time.millisecond = 0; |
88 | 88 |
89 return base::Time::FromLocalExploded(exploded_reference_time); | 89 return base::Time::FromLocalExploded(exploded_reference_time); |
90 } | 90 } |
91 | 91 |
92 scoped_ptr<KeyedService> BuildTestHistoryService( | 92 scoped_ptr<KeyedService> BuildTestHistoryService( |
93 content::BrowserContext* context) { | 93 content::BrowserContext* context) { |
94 scoped_ptr<history::HistoryService> service(new history::HistoryService()); | 94 scoped_ptr<history::HistoryService> service(new history::HistoryService()); |
95 service->Init(std::string(), | 95 service->Init(history::TestHistoryDatabaseParamsForPath(g_temp_history_dir)); |
96 history::TestHistoryDatabaseParamsForPath(g_temp_history_dir)); | |
97 return std::move(service); | 96 return std::move(service); |
98 } | 97 } |
99 | 98 |
100 } // namespace | 99 } // namespace |
101 | 100 |
102 class SiteEngagementScoreTest : public testing::Test { | 101 class SiteEngagementScoreTest : public testing::Test { |
103 public: | 102 public: |
104 SiteEngagementScoreTest() : score_(&test_clock_) {} | 103 SiteEngagementScoreTest() : score_(&test_clock_) {} |
105 | 104 |
106 void SetUp() override { | 105 void SetUp() override { |
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1373 0, 2); | 1372 0, 2); |
1374 | 1373 |
1375 // Add more points and ensure no more samples are present. | 1374 // Add more points and ensure no more samples are present. |
1376 service->AddPoints(origin1, 0.01); | 1375 service->AddPoints(origin1, 0.01); |
1377 service->AddPoints(origin2, 0.01); | 1376 service->AddPoints(origin2, 0.01); |
1378 histograms.ExpectTotalCount(SiteEngagementMetrics::kScoreDecayedFromHistogram, | 1377 histograms.ExpectTotalCount(SiteEngagementMetrics::kScoreDecayedFromHistogram, |
1379 4); | 1378 4); |
1380 histograms.ExpectTotalCount(SiteEngagementMetrics::kScoreDecayedToHistogram, | 1379 histograms.ExpectTotalCount(SiteEngagementMetrics::kScoreDecayedToHistogram, |
1381 4); | 1380 4); |
1382 } | 1381 } |
OLD | NEW |