Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(255)

Side by Side Diff: chrome/browser/engagement/site_engagement_service_unittest.cc

Issue 2735333002: Rename SiteEngagementService::ResetScoreForURL. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1679 TEST_F(SiteEngagementServiceTest, CleanupMovesScoreBackToRebase) { 1679 TEST_F(SiteEngagementServiceTest, CleanupMovesScoreBackToRebase) {
1680 base::SimpleTestClock* clock = new base::SimpleTestClock(); 1680 base::SimpleTestClock* clock = new base::SimpleTestClock();
1681 std::unique_ptr<SiteEngagementService> service( 1681 std::unique_ptr<SiteEngagementService> service(
1682 new SiteEngagementService(profile(), base::WrapUnique(clock))); 1682 new SiteEngagementService(profile(), base::WrapUnique(clock)));
1683 base::Time last_engagement_time; 1683 base::Time last_engagement_time;
1684 1684
1685 base::Time current_day = GetReferenceTime(); 1685 base::Time current_day = GetReferenceTime();
1686 clock->SetNow(current_day); 1686 clock->SetNow(current_day);
1687 1687
1688 GURL origin("http://www.google.com/"); 1688 GURL origin("http://www.google.com/");
1689 service->ResetScoreForURL(origin, 5); 1689 service->ResetBaseScoreForURL(origin, 5);
1690 service->AddPoints(origin, 5); 1690 service->AddPoints(origin, 5);
1691 EXPECT_EQ(10, service->GetScore(origin)); 1691 EXPECT_EQ(10, service->GetScore(origin));
1692 EXPECT_EQ(current_day, service->GetLastEngagementTime()); 1692 EXPECT_EQ(current_day, service->GetLastEngagementTime());
1693 1693
1694 // Send the clock back in time before the stale period and add engagement for 1694 // Send the clock back in time before the stale period and add engagement for
1695 // a new origin. 1695 // a new origin.
1696 base::Time before_stale_period = 1696 base::Time before_stale_period =
1697 clock->Now() - service->GetStalePeriod() - service->GetMaxDecayPeriod(); 1697 clock->Now() - service->GetStalePeriod() - service->GetMaxDecayPeriod();
1698 clock->SetNow(before_stale_period); 1698 clock->SetNow(before_stale_period);
1699 1699
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1809 1809
1810 EXPECT_EQ(3, CheckScoreFromSettingsOnThread(content::BrowserThread::IO, 1810 EXPECT_EQ(3, CheckScoreFromSettingsOnThread(content::BrowserThread::IO,
1811 settings_map, url1)); 1811 settings_map, url1));
1812 EXPECT_EQ(3, CheckScoreFromSettingsOnThread(content::BrowserThread::FILE, 1812 EXPECT_EQ(3, CheckScoreFromSettingsOnThread(content::BrowserThread::FILE,
1813 settings_map, url2)); 1813 settings_map, url2));
1814 EXPECT_EQ(4, CheckScoreFromSettingsOnThread(content::BrowserThread::FILE, 1814 EXPECT_EQ(4, CheckScoreFromSettingsOnThread(content::BrowserThread::FILE,
1815 incognito_settings_map, url1)); 1815 incognito_settings_map, url1));
1816 EXPECT_EQ(3, CheckScoreFromSettingsOnThread(content::BrowserThread::IO, 1816 EXPECT_EQ(3, CheckScoreFromSettingsOnThread(content::BrowserThread::IO,
1817 incognito_settings_map, url2)); 1817 incognito_settings_map, url2));
1818 } 1818 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698