| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/android/preferences/important_sites_util.h" | 5 #include "chrome/browser/android/preferences/important_sites_util.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 return std::move(service); | 39 return std::move(service); |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 class ImportantSitesUtilTest : public ChromeRenderViewHostTestHarness { | 44 class ImportantSitesUtilTest : public ChromeRenderViewHostTestHarness { |
| 45 public: | 45 public: |
| 46 void SetUp() override { | 46 void SetUp() override { |
| 47 ChromeRenderViewHostTestHarness::SetUp(); | 47 ChromeRenderViewHostTestHarness::SetUp(); |
| 48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 48 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 49 g_temp_history_dir = temp_dir_.path(); | 49 g_temp_history_dir = temp_dir_.GetPath(); |
| 50 HistoryServiceFactory::GetInstance()->SetTestingFactory( | 50 HistoryServiceFactory::GetInstance()->SetTestingFactory( |
| 51 profile(), &BuildTestHistoryService); | 51 profile(), &BuildTestHistoryService); |
| 52 SiteEngagementScore::SetParamValuesForTesting(); | 52 SiteEngagementScore::SetParamValuesForTesting(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void AddContentSetting(ContentSettingsType type, | 55 void AddContentSetting(ContentSettingsType type, |
| 56 ContentSetting setting, | 56 ContentSetting setting, |
| 57 const GURL& origin) { | 57 const GURL& origin) { |
| 58 ContentSettingsForOneType settings_list; | 58 ContentSettingsForOneType settings_list; |
| 59 | 59 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 GURL url1("http://www.google.com/"); | 136 GURL url1("http://www.google.com/"); |
| 137 | 137 |
| 138 service->ResetScoreForURL(url1, 5); | 138 service->ResetScoreForURL(url1, 5); |
| 139 | 139 |
| 140 std::vector<std::string> expected_sorted_domains = {"google.com"}; | 140 std::vector<std::string> expected_sorted_domains = {"google.com"}; |
| 141 EXPECT_THAT(ImportantSitesUtil::GetImportantRegisterableDomains( | 141 EXPECT_THAT(ImportantSitesUtil::GetImportantRegisterableDomains( |
| 142 profile(), kNumImportantSites, nullptr), | 142 profile(), kNumImportantSites, nullptr), |
| 143 ::testing::ElementsAreArray(expected_sorted_domains)); | 143 ::testing::ElementsAreArray(expected_sorted_domains)); |
| 144 } | 144 } |
| OLD | NEW |