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/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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 const char kUrl5[] = "http://www.fake5.com/"; | 44 const char kUrl5[] = "http://www.fake5.com/"; |
45 const char kUrl6[] = "http://www.fake6.com/"; | 45 const char kUrl6[] = "http://www.fake6.com/"; |
46 const char kUrl7[] = "http://www.fake7.com/"; | 46 const char kUrl7[] = "http://www.fake7.com/"; |
47 const char kUrl8[] = "http://www.fake8.com/"; | 47 const char kUrl8[] = "http://www.fake8.com/"; |
48 const char kUrl9[] = "http://www.fake9.com/"; | 48 const char kUrl9[] = "http://www.fake9.com/"; |
49 const char kUrl10[] = "http://www.fake10.com/"; | 49 const char kUrl10[] = "http://www.fake10.com/"; |
50 const char kUrl11[] = "http://www.fake11.com/"; | 50 const char kUrl11[] = "http://www.fake11.com/"; |
51 const char kTitle[] = "title is ignored"; | 51 const char kTitle[] = "title is ignored"; |
52 | 52 |
53 SessionWindow* GetOrCreateWindow(SyncedSession* session, int window_id) { | 53 SessionWindow* GetOrCreateWindow(SyncedSession* session, int window_id) { |
54 if (session->windows.find(window_id) == session->windows.end()) | 54 if (session->windows.find(window_id) == session->windows.end()) { |
55 session->windows[window_id] = base::MakeUnique<SessionWindow>(); | 55 session->windows[window_id] = base::MakeUnique<SessionWindow>(); |
| 56 } |
56 | 57 |
57 return session->windows[window_id].get(); | 58 return session->windows[window_id].get(); |
58 } | 59 } |
59 | 60 |
60 void AddTabToSession(SyncedSession* session, | 61 void AddTabToSession(SyncedSession* session, |
61 int window_id, | 62 int window_id, |
62 const std::string& url, | 63 const std::string& url, |
63 TimeDelta age) { | 64 TimeDelta age) { |
64 SerializedNavigationEntry navigation = | 65 SerializedNavigationEntry navigation = |
65 sessions::SerializedNavigationEntryTestHelper::CreateNavigation(url, | 66 sessions::SerializedNavigationEntryTestHelper::CreateNavigation(url, |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 EXPECT_CALL(*observer(), | 369 EXPECT_CALL(*observer(), |
369 OnNewSuggestions( | 370 OnNewSuggestions( |
370 _, category(), | 371 _, category(), |
371 ElementsAre(Property(&ContentSuggestion::url, GURL(kUrl1)), | 372 ElementsAre(Property(&ContentSuggestion::url, GURL(kUrl1)), |
372 Property(&ContentSuggestion::url, GURL(kUrl2))))); | 373 Property(&ContentSuggestion::url, GURL(kUrl2))))); |
373 AddTab(0, 0, kUrl2, TimeDelta::FromMinutes(2)); | 374 AddTab(0, 0, kUrl2, TimeDelta::FromMinutes(2)); |
374 TriggerOnChange(); | 375 TriggerOnChange(); |
375 } | 376 } |
376 | 377 |
377 } // namespace ntp_snippets | 378 } // namespace ntp_snippets |
OLD | NEW |