| 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 <memory> | 7 #include <memory> | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" | 
| 11 #include "base/test/histogram_tester.h" | 11 #include "base/test/histogram_tester.h" | 
| 12 #include "components/sessions/core/serialized_navigation_entry.h" | 12 #include "components/sessions/core/serialized_navigation_entry.h" | 
| 13 #include "components/sessions/core/serialized_navigation_entry_test_helper.h" | 13 #include "components/sessions/core/serialized_navigation_entry_test_helper.h" | 
| 14 #include "components/sessions/core/session_types.h" | 14 #include "components/sessions/core/session_types.h" | 
| 15 #include "components/sync_sessions/revisit/page_visit_observer.h" | 15 #include "components/sync_sessions/revisit/page_visit_observer.h" | 
| 16 #include "components/sync_sessions/synced_session.h" | 16 #include "components/sync_sessions/synced_session.h" | 
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" | 
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" | 
| 19 | 19 | 
| 20 using sessions::SessionTab; | 20 using sessions::SessionTab; | 
| 21 using sessions::SessionWindow; | 21 using sessions::SessionWindow; | 
| 22 using sync_driver::SyncedSession; |  | 
| 23 | 22 | 
| 24 namespace sync_sessions { | 23 namespace sync_sessions { | 
| 25 | 24 | 
| 26 namespace { | 25 namespace { | 
| 27 | 26 | 
| 28 static const std::string kExampleUrl = "http://www.example.com"; | 27 static const char kExampleUrl[] = "http://www.example.com"; | 
| 29 static const std::string kDifferentUrl = "http://www.different.com"; | 28 static const char kDifferentUrl[] = "http://www.different.com"; | 
| 30 | 29 | 
| 31 class TestForeignSessionsProvider : public ForeignSessionsProvider { | 30 class TestForeignSessionsProvider : public ForeignSessionsProvider { | 
| 32  public: | 31  public: | 
| 33   TestForeignSessionsProvider(const std::vector<const SyncedSession*>& sessions, | 32   TestForeignSessionsProvider(const std::vector<const SyncedSession*>& sessions, | 
| 34                               bool return_value) | 33                               bool return_value) | 
| 35       : sessions_(sessions), return_value_(return_value) {} | 34       : sessions_(sessions), return_value_(return_value) {} | 
| 36   ~TestForeignSessionsProvider() override{}; | 35   ~TestForeignSessionsProvider() override{}; | 
| 37 | 36 | 
| 38   bool GetAllForeignSessions( | 37   bool GetAllForeignSessions( | 
| 39       std::vector<const SyncedSession*>* sessions) override { | 38       std::vector<const SyncedSession*>* sessions) override { | 
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 189   sessions.push_back(session1.get()); | 188   sessions.push_back(session1.get()); | 
| 190   sessions.push_back(session2.get()); | 189   sessions.push_back(session2.get()); | 
| 191   SessionsPageRevisitObserver observer( | 190   SessionsPageRevisitObserver observer( | 
| 192       base::MakeUnique<TestForeignSessionsProvider>(sessions, true)); | 191       base::MakeUnique<TestForeignSessionsProvider>(sessions, true)); | 
| 193 | 192 | 
| 194   base::HistogramTester histogram_tester; | 193   base::HistogramTester histogram_tester; | 
| 195   CheckAndExpect(&observer, GURL(kExampleUrl), true, true); | 194   CheckAndExpect(&observer, GURL(kExampleUrl), true, true); | 
| 196 } | 195 } | 
| 197 | 196 | 
| 198 }  // namespace sync_sessions | 197 }  // namespace sync_sessions | 
| OLD | NEW | 
|---|