| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 base::RunLoop run_loop_; | 140 base::RunLoop run_loop_; |
| 141 | 141 |
| 142 DISALLOW_COPY_AND_ASSIGN(ObserverTester); | 142 DISALLOW_COPY_AND_ASSIGN(ObserverTester); |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 class SiteEngagementServiceTest : public ChromeRenderViewHostTestHarness { | 145 class SiteEngagementServiceTest : public ChromeRenderViewHostTestHarness { |
| 146 public: | 146 public: |
| 147 void SetUp() override { | 147 void SetUp() override { |
| 148 ChromeRenderViewHostTestHarness::SetUp(); | 148 ChromeRenderViewHostTestHarness::SetUp(); |
| 149 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 149 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 150 g_temp_history_dir = temp_dir_.path(); | 150 g_temp_history_dir = temp_dir_.GetPath(); |
| 151 HistoryServiceFactory::GetInstance()->SetTestingFactory( | 151 HistoryServiceFactory::GetInstance()->SetTestingFactory( |
| 152 profile(), &BuildTestHistoryService); | 152 profile(), &BuildTestHistoryService); |
| 153 SiteEngagementScore::SetParamValuesForTesting(); | 153 SiteEngagementScore::SetParamValuesForTesting(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 void NavigateWithTransitionAndExpectHigherScore( | 156 void NavigateWithTransitionAndExpectHigherScore( |
| 157 SiteEngagementService* service, | 157 SiteEngagementService* service, |
| 158 const GURL& url, | 158 const GURL& url, |
| 159 ui::PageTransition transition) { | 159 ui::PageTransition transition) { |
| 160 double prev_score = service->GetScore(url); | 160 double prev_score = service->GetScore(url); |
| (...skipping 1346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 | 1507 |
| 1508 service->AddPoints(url3, 2); | 1508 service->AddPoints(url3, 2); |
| 1509 EXPECT_EQ(1, incognito_service->GetScore(url3)); | 1509 EXPECT_EQ(1, incognito_service->GetScore(url3)); |
| 1510 EXPECT_EQ(2, service->GetScore(url3)); | 1510 EXPECT_EQ(2, service->GetScore(url3)); |
| 1511 | 1511 |
| 1512 EXPECT_EQ(0, incognito_service->GetScore(url4)); | 1512 EXPECT_EQ(0, incognito_service->GetScore(url4)); |
| 1513 service->AddPoints(url4, 2); | 1513 service->AddPoints(url4, 2); |
| 1514 EXPECT_EQ(2, incognito_service->GetScore(url4)); | 1514 EXPECT_EQ(2, incognito_service->GetScore(url4)); |
| 1515 EXPECT_EQ(2, service->GetScore(url4)); | 1515 EXPECT_EQ(2, service->GetScore(url4)); |
| 1516 } | 1516 } |
| OLD | NEW |