| 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 15 matching lines...) Expand all Loading... |
| 26 #include "components/keyed_service/core/keyed_service.h" | 26 #include "components/keyed_service/core/keyed_service.h" |
| 27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 28 #include "testing/gmock/include/gmock/gmock.h" | 28 #include "testing/gmock/include/gmock/gmock.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 30 |
| 31 namespace { | 31 namespace { |
| 32 | 32 |
| 33 const size_t kNumImportantSites = 5; | 33 const size_t kNumImportantSites = 5; |
| 34 base::FilePath g_temp_history_dir; | 34 base::FilePath g_temp_history_dir; |
| 35 | 35 |
| 36 scoped_ptr<KeyedService> BuildTestHistoryService( | 36 std::unique_ptr<KeyedService> BuildTestHistoryService( |
| 37 content::BrowserContext* context) { | 37 content::BrowserContext* context) { |
| 38 scoped_ptr<history::HistoryService> service(new history::HistoryService()); | 38 std::unique_ptr<history::HistoryService> service( |
| 39 new history::HistoryService()); |
| 39 service->Init(history::TestHistoryDatabaseParamsForPath(g_temp_history_dir)); | 40 service->Init(history::TestHistoryDatabaseParamsForPath(g_temp_history_dir)); |
| 40 return std::move(service); | 41 return std::move(service); |
| 41 } | 42 } |
| 42 | 43 |
| 43 } // namespace | 44 } // namespace |
| 44 | 45 |
| 45 class ImportantSitesUtilTest : public ChromeRenderViewHostTestHarness { | 46 class ImportantSitesUtilTest : public ChromeRenderViewHostTestHarness { |
| 46 public: | 47 public: |
| 47 void SetUp() override { | 48 void SetUp() override { |
| 48 ChromeRenderViewHostTestHarness::SetUp(); | 49 ChromeRenderViewHostTestHarness::SetUp(); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 AddContentSetting(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_BLOCK, | 116 AddContentSetting(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, CONTENT_SETTING_BLOCK, |
| 116 url1); | 117 url1); |
| 117 | 118 |
| 118 // Same as above, but the site with notifications should be at the front. | 119 // Same as above, but the site with notifications should be at the front. |
| 119 expected_sorted_domains = {"youtube.com", "foo.bar", "example.com", | 120 expected_sorted_domains = {"youtube.com", "foo.bar", "example.com", |
| 120 "chrome.com", "google.com"}; | 121 "chrome.com", "google.com"}; |
| 121 EXPECT_THAT(ImportantSitesUtil::GetImportantRegisterableDomains( | 122 EXPECT_THAT(ImportantSitesUtil::GetImportantRegisterableDomains( |
| 122 profile(), kNumImportantSites), | 123 profile(), kNumImportantSites), |
| 123 ::testing::ElementsAreArray(expected_sorted_domains)); | 124 ::testing::ElementsAreArray(expected_sorted_domains)); |
| 124 } | 125 } |
| OLD | NEW |