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/ntp_snippets/download_suggestions_provider.h" | 5 #include "chrome/browser/ntp_snippets/download_suggestions_provider.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
13 #include "base/test/simple_test_clock.h" | 13 #include "base/test/simple_test_clock.h" |
14 #include "base/time/default_clock.h" | 14 #include "base/time/default_clock.h" |
15 #include "chrome/browser/ntp_snippets/fake_download_item.h" | |
16 #include "components/ntp_snippets/category.h" | 15 #include "components/ntp_snippets/category.h" |
17 #include "components/ntp_snippets/mock_content_suggestions_provider_observer.h" | 16 #include "components/ntp_snippets/mock_content_suggestions_provider_observer.h" |
18 #include "components/ntp_snippets/offline_pages/offline_pages_test_utils.h" | 17 #include "components/ntp_snippets/offline_pages/offline_pages_test_utils.h" |
19 #include "components/offline_pages/core/client_namespace_constants.h" | 18 #include "components/offline_pages/core/client_namespace_constants.h" |
20 #include "components/prefs/testing_pref_service.h" | 19 #include "components/prefs/testing_pref_service.h" |
| 20 #include "content/public/test/fake_download_item.h" |
21 #include "content/public/test/mock_download_item.h" | 21 #include "content/public/test/mock_download_item.h" |
22 #include "content/public/test/mock_download_manager.h" | 22 #include "content/public/test/mock_download_manager.h" |
23 #include "content/public/test/test_browser_thread_bundle.h" | 23 #include "content/public/test/test_browser_thread_bundle.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 | 25 |
26 using content::DownloadItem; | 26 using content::DownloadItem; |
| 27 using content::FakeDownloadItem; |
27 using content::MockDownloadManager; | 28 using content::MockDownloadManager; |
28 using ntp_snippets::Category; | 29 using ntp_snippets::Category; |
29 using ntp_snippets::CategoryStatus; | 30 using ntp_snippets::CategoryStatus; |
30 using ntp_snippets::ContentSuggestion; | 31 using ntp_snippets::ContentSuggestion; |
31 using ntp_snippets::ContentSuggestionsProvider; | 32 using ntp_snippets::ContentSuggestionsProvider; |
32 using ntp_snippets::MockContentSuggestionsProviderObserver; | 33 using ntp_snippets::MockContentSuggestionsProviderObserver; |
33 using ntp_snippets::test::CaptureDismissedSuggestions; | 34 using ntp_snippets::test::CaptureDismissedSuggestions; |
34 using ntp_snippets::test::FakeOfflinePageModel; | 35 using ntp_snippets::test::FakeOfflinePageModel; |
35 using offline_pages::ClientId; | 36 using offline_pages::ClientId; |
36 using offline_pages::OfflinePageItem; | 37 using offline_pages::OfflinePageItem; |
37 using test::FakeDownloadItem; | |
38 using testing::_; | 38 using testing::_; |
39 using testing::AllOf; | 39 using testing::AllOf; |
40 using testing::AnyNumber; | 40 using testing::AnyNumber; |
41 using testing::ElementsAre; | 41 using testing::ElementsAre; |
42 using testing::IsEmpty; | 42 using testing::IsEmpty; |
43 using testing::Lt; | 43 using testing::Lt; |
44 using testing::Mock; | 44 using testing::Mock; |
45 using testing::Return; | 45 using testing::Return; |
46 using testing::SizeIs; | 46 using testing::SizeIs; |
47 using testing::StrictMock; | 47 using testing::StrictMock; |
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 // it has been visited recently. | 1105 // it has been visited recently. |
1106 EXPECT_CALL( | 1106 EXPECT_CALL( |
1107 *observer(), | 1107 *observer(), |
1108 OnNewSuggestions(_, downloads_category(), | 1108 OnNewSuggestions(_, downloads_category(), |
1109 UnorderedElementsAre(HasUrl("http://dummy.com/0")))); | 1109 UnorderedElementsAre(HasUrl("http://dummy.com/0")))); |
1110 auto test_clock = base::MakeUnique<base::SimpleTestClock>(); | 1110 auto test_clock = base::MakeUnique<base::SimpleTestClock>(); |
1111 test_clock->SetNow(now); | 1111 test_clock->SetNow(now); |
1112 CreateProvider(/*show_assets=*/false, /*show_offline_pages=*/true, | 1112 CreateProvider(/*show_assets=*/false, /*show_offline_pages=*/true, |
1113 std::move(test_clock)); | 1113 std::move(test_clock)); |
1114 } | 1114 } |
OLD | NEW |