Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: components/ntp_snippets/sessions/foreign_sessions_suggestions_provider_unittest.cc

Issue 2377663002: [NTP Snippets] Introduce ContentSuggestion::ID (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/sessions/foreign_sessions_suggestions_provider .h" 5 #include "components/ntp_snippets/sessions/foreign_sessions_suggestions_provider .h"
6 6
7 #include <map> 7 #include <map>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 142
143 void TriggerOnChange() { 143 void TriggerOnChange() {
144 std::vector<const SyncedSession*> sessions; 144 std::vector<const SyncedSession*> sessions;
145 for (const auto& kv : sessions_map_) { 145 for (const auto& kv : sessions_map_) {
146 sessions.push_back(kv.second.get()); 146 sessions.push_back(kv.second.get());
147 } 147 }
148 fake_foreign_sessions_provider_->SetAllForeignSessions(std::move(sessions)); 148 fake_foreign_sessions_provider_->SetAllForeignSessions(std::move(sessions));
149 } 149 }
150 150
151 void Dismiss(const std::string& url) { 151 void Dismiss(const std::string& url) {
152 // The url of a given suggestion is used as the |within_category_id|. 152 // The url of a given suggestion is used as the |id_within_category|.
153 provider_->DismissSuggestion(provider_->MakeUniqueID(category(), url)); 153 provider_->DismissSuggestion(ContentSuggestion::ID(category(), url));
154 } 154 }
155 155
156 Category category() { 156 Category category() {
157 return category_factory_.FromKnownCategory(KnownCategories::FOREIGN_TABS); 157 return category_factory_.FromKnownCategory(KnownCategories::FOREIGN_TABS);
158 } 158 }
159 159
160 MockContentSuggestionsProviderObserver* observer() { return &observer_; } 160 MockContentSuggestionsProviderObserver* observer() { return &observer_; }
161 161
162 private: 162 private:
163 FakeForeignSessionsProvider* fake_foreign_sessions_provider_; 163 FakeForeignSessionsProvider* fake_foreign_sessions_provider_;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 AddTab(0, 0, kUrl1, TimeDelta::FromMinutes(1)); 317 AddTab(0, 0, kUrl1, TimeDelta::FromMinutes(1));
318 AddTab(0, 0, kUrl2, TimeDelta::FromMinutes(2)); 318 AddTab(0, 0, kUrl2, TimeDelta::FromMinutes(2));
319 AddTab(0, 0, kUrl3, TimeDelta::FromMinutes(3)); 319 AddTab(0, 0, kUrl3, TimeDelta::FromMinutes(3));
320 AddTab(0, 0, kUrl4, TimeDelta::FromMinutes(4)); 320 AddTab(0, 0, kUrl4, TimeDelta::FromMinutes(4));
321 AddTab(0, 0, kUrl5, TimeDelta::FromMinutes(5)); 321 AddTab(0, 0, kUrl5, TimeDelta::FromMinutes(5));
322 AddTab(0, 0, kUrl6, TimeDelta::FromMinutes(6)); 322 AddTab(0, 0, kUrl6, TimeDelta::FromMinutes(6));
323 TriggerOnChange(); 323 TriggerOnChange();
324 } 324 }
325 325
326 } // namespace ntp_snippets 326 } // namespace ntp_snippets
OLDNEW
« no previous file with comments | « components/ntp_snippets/sessions/foreign_sessions_suggestions_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698