| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 GURL("http://dummy.com/3")), | 140 GURL("http://dummy.com/3")), |
| 141 Property(&ContentSuggestion::url, | 141 Property(&ContentSuggestion::url, |
| 142 GURL("http://dummy.com/1")), | 142 GURL("http://dummy.com/1")), |
| 143 Property(&ContentSuggestion::url, | 143 Property(&ContentSuggestion::url, |
| 144 GURL("http://dummy.com/2"))))); | 144 GURL("http://dummy.com/2"))))); |
| 145 FireOfflinePageModelChanged(offline_pages); | 145 FireOfflinePageModelChanged(offline_pages); |
| 146 } | 146 } |
| 147 | 147 |
| 148 TEST_F(RecentTabSuggestionsProviderTest, ShouldDeliverCorrectCategoryInfo) { | 148 TEST_F(RecentTabSuggestionsProviderTest, ShouldDeliverCorrectCategoryInfo) { |
| 149 EXPECT_FALSE( | 149 EXPECT_FALSE( |
| 150 provider()->GetCategoryInfo(recent_tabs_category()).has_more_button()); | 150 provider()->GetCategoryInfo(recent_tabs_category()).has_more_action()); |
| 151 EXPECT_FALSE( |
| 152 provider()->GetCategoryInfo(recent_tabs_category()).has_reload_action()); |
| 153 EXPECT_FALSE(provider() |
| 154 ->GetCategoryInfo(recent_tabs_category()) |
| 155 .has_view_all_action()); |
| 151 } | 156 } |
| 152 | 157 |
| 153 TEST_F(RecentTabSuggestionsProviderTest, ShouldDismiss) { | 158 TEST_F(RecentTabSuggestionsProviderTest, ShouldDismiss) { |
| 154 // OfflinePageModel is initialised here because | 159 // OfflinePageModel is initialised here because |
| 155 // |GetDismissedSuggestionsForDebugging| may need to call |GetAllPages| | 160 // |GetDismissedSuggestionsForDebugging| may need to call |GetAllPages| |
| 156 *(model()->mutable_items()) = CreateDummyRecentTabs({1, 2, 3, 4}); | 161 *(model()->mutable_items()) = CreateDummyRecentTabs({1, 2, 3, 4}); |
| 157 FireOfflinePageModelChanged(model()->items()); | 162 FireOfflinePageModelChanged(model()->items()); |
| 158 | 163 |
| 159 // Dismiss 2 and 3. | 164 // Dismiss 2 and 3. |
| 160 EXPECT_CALL(*observer(), OnNewSuggestions(_, _, _)).Times(0); | 165 EXPECT_CALL(*observer(), OnNewSuggestions(_, _, _)).Times(0); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 EXPECT_THAT(ReadDismissedIDsFromPrefs(), SizeIs(2)); | 239 EXPECT_THAT(ReadDismissedIDsFromPrefs(), SizeIs(2)); |
| 235 | 240 |
| 236 FireOfflinePageModelChanged(CreateDummyRecentTabs({2})); | 241 FireOfflinePageModelChanged(CreateDummyRecentTabs({2})); |
| 237 EXPECT_THAT(ReadDismissedIDsFromPrefs(), SizeIs(1)); | 242 EXPECT_THAT(ReadDismissedIDsFromPrefs(), SizeIs(1)); |
| 238 | 243 |
| 239 FireOfflinePageModelChanged(std::vector<OfflinePageItem>()); | 244 FireOfflinePageModelChanged(std::vector<OfflinePageItem>()); |
| 240 EXPECT_THAT(ReadDismissedIDsFromPrefs(), IsEmpty()); | 245 EXPECT_THAT(ReadDismissedIDsFromPrefs(), IsEmpty()); |
| 241 } | 246 } |
| 242 | 247 |
| 243 } // namespace ntp_snippets | 248 } // namespace ntp_snippets |
| OLD | NEW |