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/offset_tab_matcher.h" | 5 #include "components/sync_sessions/revisit/offset_tab_matcher.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.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 "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 | 17 |
18 using sessions::SessionTab; | 18 using sessions::SessionTab; |
19 | 19 |
20 namespace sync_sessions { | 20 namespace sync_sessions { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 static const std::string kExampleUrl = "http://www.example.com"; | 24 const char kExampleUrl[] = "http://www.example.com"; |
25 static const std::string kDifferentUrl = "http://www.different.com"; | 25 const char kDifferentUrl[] = "http://www.different.com"; |
26 | 26 |
27 sessions::SerializedNavigationEntry Entry(const std::string& url) { | 27 sessions::SerializedNavigationEntry Entry(const std::string& url) { |
28 return sessions::SerializedNavigationEntryTestHelper::CreateNavigation(url, | 28 return sessions::SerializedNavigationEntryTestHelper::CreateNavigation(url, |
29 ""); | 29 ""); |
30 } | 30 } |
31 | 31 |
32 std::unique_ptr<SessionTab> Tab( | 32 std::unique_ptr<SessionTab> Tab( |
33 const int index, | 33 const int index, |
34 const base::Time timestamp = base::Time::Now()) { | 34 const base::Time timestamp = base::Time::Now()) { |
35 std::unique_ptr<SessionTab> tab(new SessionTab()); | 35 std::unique_ptr<SessionTab> tab(new SessionTab()); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 tab2->navigations.push_back(Entry(kExampleUrl)); | 179 tab2->navigations.push_back(Entry(kExampleUrl)); |
180 tab2->navigations.push_back(Entry(kExampleUrl)); | 180 tab2->navigations.push_back(Entry(kExampleUrl)); |
181 | 181 |
182 OffsetTabMatcher matcher((PageEquality(GURL(kExampleUrl)))); | 182 OffsetTabMatcher matcher((PageEquality(GURL(kExampleUrl)))); |
183 matcher.Check(tab1.get()); | 183 matcher.Check(tab1.get()); |
184 matcher.Check(tab2.get()); | 184 matcher.Check(tab2.get()); |
185 VerifyMatch(&matcher, 1); | 185 VerifyMatch(&matcher, 1); |
186 } | 186 } |
187 | 187 |
188 } // namespace sync_sessions | 188 } // namespace sync_sessions |
OLD | NEW |