| 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 "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" | 5 #include "components/ntp_snippets/offline_pages/recent_tab_suggestions_provider.
h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 GURL("http://dummy.com/3")), | 169 GURL("http://dummy.com/3")), |
| 170 Property(&ContentSuggestion::url, | 170 Property(&ContentSuggestion::url, |
| 171 GURL("http://dummy.com/1")), | 171 GURL("http://dummy.com/1")), |
| 172 Property(&ContentSuggestion::url, | 172 Property(&ContentSuggestion::url, |
| 173 GURL("http://dummy.com/2"))))); | 173 GURL("http://dummy.com/2"))))); |
| 174 FireOfflinePageModelChanged(offline_pages); | 174 FireOfflinePageModelChanged(offline_pages); |
| 175 } | 175 } |
| 176 | 176 |
| 177 TEST_F(RecentTabSuggestionsProviderTest, ShouldDeliverCorrectCategoryInfo) { | 177 TEST_F(RecentTabSuggestionsProviderTest, ShouldDeliverCorrectCategoryInfo) { |
| 178 EXPECT_FALSE( | 178 EXPECT_FALSE( |
| 179 provider()->GetCategoryInfo(recent_tabs_category()).has_more_button()); | 179 provider()->GetCategoryInfo(recent_tabs_category()).has_more_action()); |
| 180 EXPECT_FALSE( |
| 181 provider()->GetCategoryInfo(recent_tabs_category()).has_reload_action()); |
| 182 EXPECT_FALSE(provider() |
| 183 ->GetCategoryInfo(recent_tabs_category()) |
| 184 .has_view_all_action()); |
| 180 } | 185 } |
| 181 | 186 |
| 182 TEST_F(RecentTabSuggestionsProviderTest, ShouldDismiss) { | 187 TEST_F(RecentTabSuggestionsProviderTest, ShouldDismiss) { |
| 183 // OfflinePageModel is initialised here because | 188 // OfflinePageModel is initialised here because |
| 184 // |GetDismissedSuggestionsForDebugging| may need to call |GetAllPages| | 189 // |GetDismissedSuggestionsForDebugging| may need to call |GetAllPages| |
| 185 *(model()->mutable_items()) = CreateDummyRecentTabs({1, 2, 3, 4}); | 190 *(model()->mutable_items()) = CreateDummyRecentTabs({1, 2, 3, 4}); |
| 186 FireOfflinePageModelChanged(model()->items()); | 191 FireOfflinePageModelChanged(model()->items()); |
| 187 | 192 |
| 188 // Dismiss 2 and 3. | 193 // Dismiss 2 and 3. |
| 189 EXPECT_CALL(*observer(), OnNewSuggestions(_, _, _)).Times(0); | 194 EXPECT_CALL(*observer(), OnNewSuggestions(_, _, _)).Times(0); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 EXPECT_THAT(ReadDismissedIDsFromPrefs(), SizeIs(2)); | 268 EXPECT_THAT(ReadDismissedIDsFromPrefs(), SizeIs(2)); |
| 264 | 269 |
| 265 FireOfflinePageModelChanged(CreateDummyRecentTabs({2})); | 270 FireOfflinePageModelChanged(CreateDummyRecentTabs({2})); |
| 266 EXPECT_THAT(ReadDismissedIDsFromPrefs(), SizeIs(1)); | 271 EXPECT_THAT(ReadDismissedIDsFromPrefs(), SizeIs(1)); |
| 267 | 272 |
| 268 FireOfflinePageModelChanged(std::vector<OfflinePageItem>()); | 273 FireOfflinePageModelChanged(std::vector<OfflinePageItem>()); |
| 269 EXPECT_THAT(ReadDismissedIDsFromPrefs(), IsEmpty()); | 274 EXPECT_THAT(ReadDismissedIDsFromPrefs(), IsEmpty()); |
| 270 } | 275 } |
| 271 | 276 |
| 272 } // namespace ntp_snippets | 277 } // namespace ntp_snippets |
| OLD | NEW |