| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/sync_sessions/revisit/sessions_page_revisit_observer.h" | 5 #include "components/sync_sessions/revisit/sessions_page_revisit_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 static const char kExampleUrl[] = "http://www.example.com"; | 26 static const char kExampleUrl[] = "http://www.example.com"; |
| 27 static const char kDifferentUrl[] = "http://www.different.com"; | 27 static const char kDifferentUrl[] = "http://www.different.com"; |
| 28 | 28 |
| 29 class TestForeignSessionsProvider : public ForeignSessionsProvider { | 29 class TestForeignSessionsProvider : public ForeignSessionsProvider { |
| 30 public: | 30 public: |
| 31 TestForeignSessionsProvider(const std::vector<const SyncedSession*>& sessions, | 31 TestForeignSessionsProvider(const std::vector<const SyncedSession*>& sessions, |
| 32 bool return_value) | 32 bool return_value) |
| 33 : sessions_(sessions), return_value_(return_value) {} | 33 : sessions_(sessions), return_value_(return_value) {} |
| 34 ~TestForeignSessionsProvider() override{}; | 34 ~TestForeignSessionsProvider() override {} |
| 35 | 35 |
| 36 bool GetAllForeignSessions( | 36 bool GetAllForeignSessions( |
| 37 std::vector<const SyncedSession*>* sessions) override { | 37 std::vector<const SyncedSession*>* sessions) override { |
| 38 sessions->clear(); | 38 sessions->clear(); |
| 39 *sessions = sessions_; | 39 *sessions = sessions_; |
| 40 return return_value_; | 40 return return_value_; |
| 41 } | 41 } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 const std::vector<const SyncedSession*>& sessions_; | 44 const std::vector<const SyncedSession*>& sessions_; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 sessions.push_back(session1.get()); | 187 sessions.push_back(session1.get()); |
| 188 sessions.push_back(session2.get()); | 188 sessions.push_back(session2.get()); |
| 189 SessionsPageRevisitObserver observer( | 189 SessionsPageRevisitObserver observer( |
| 190 base::MakeUnique<TestForeignSessionsProvider>(sessions, true)); | 190 base::MakeUnique<TestForeignSessionsProvider>(sessions, true)); |
| 191 | 191 |
| 192 base::HistogramTester histogram_tester; | 192 base::HistogramTester histogram_tester; |
| 193 CheckAndExpect(&observer, GURL(kExampleUrl), true, true); | 193 CheckAndExpect(&observer, GURL(kExampleUrl), true, true); |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace sync_sessions | 196 } // namespace sync_sessions |
| OLD | NEW |