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" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 *result_listener << "has no download_suggestion_extra"; | 110 *result_listener << "has no download_suggestion_extra"; |
111 return false; | 111 return false; |
112 } | 112 } |
113 auto extra = *arg.download_suggestion_extra(); | 113 auto extra = *arg.download_suggestion_extra(); |
114 *result_listener << "expected download asset?: " << is_download_asset | 114 *result_listener << "expected download asset?: " << is_download_asset |
115 << "\n actual is download asset?: " | 115 << "\n actual is download asset?: " |
116 << extra.is_download_asset; | 116 << extra.is_download_asset; |
117 if (extra.is_download_asset != is_download_asset) { | 117 if (extra.is_download_asset != is_download_asset) { |
118 return false; | 118 return false; |
119 } | 119 } |
120 *result_listener << "expected target_file_path: " | 120 *result_listener << "expected target_file_path: " << target_file_path |
121 << target_file_path | |
122 << "\nactual target_file_path: " | 121 << "\nactual target_file_path: " |
123 << extra.target_file_path.value(); | 122 << extra.target_file_path.value(); |
124 if (extra.target_file_path.value() != | 123 if (extra.target_file_path.value() != |
125 base::FilePath::StringType(target_file_path)) { | 124 base::FilePath::StringType(target_file_path)) { |
126 return false; | 125 return false; |
127 } | 126 } |
128 *result_listener << "expected mime_type: " << mime_type | 127 *result_listener << "expected mime_type: " << mime_type |
129 << "\nactual mime_type: " | 128 << "\nactual mime_type: " << extra.mime_type; |
130 << extra.mime_type; | |
131 return extra.mime_type == mime_type; | 129 return extra.mime_type == mime_type; |
132 } | 130 } |
133 | 131 |
134 OfflinePageItem CreateDummyOfflinePage(int id) { | 132 OfflinePageItem CreateDummyOfflinePage(int id) { |
135 return ntp_snippets::test::CreateDummyOfflinePageItem( | 133 return ntp_snippets::test::CreateDummyOfflinePageItem( |
136 id, offline_pages::kAsyncNamespace); | 134 id, offline_pages::kAsyncNamespace); |
137 } | 135 } |
138 | 136 |
139 std::vector<OfflinePageItem> CreateDummyOfflinePages( | 137 std::vector<OfflinePageItem> CreateDummyOfflinePages( |
140 const std::vector<int>& ids) { | 138 const std::vector<int>& ids) { |
(...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1105 // it has been visited recently. | 1103 // it has been visited recently. |
1106 EXPECT_CALL( | 1104 EXPECT_CALL( |
1107 *observer(), | 1105 *observer(), |
1108 OnNewSuggestions(_, downloads_category(), | 1106 OnNewSuggestions(_, downloads_category(), |
1109 UnorderedElementsAre(HasUrl("http://dummy.com/0")))); | 1107 UnorderedElementsAre(HasUrl("http://dummy.com/0")))); |
1110 auto test_clock = base::MakeUnique<base::SimpleTestClock>(); | 1108 auto test_clock = base::MakeUnique<base::SimpleTestClock>(); |
1111 test_clock->SetNow(now); | 1109 test_clock->SetNow(now); |
1112 CreateProvider(/*show_assets=*/false, /*show_offline_pages=*/true, | 1110 CreateProvider(/*show_assets=*/false, /*show_offline_pages=*/true, |
1113 std::move(test_clock)); | 1111 std::move(test_clock)); |
1114 } | 1112 } |
OLD | NEW |