OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "chrome/browser/history/history.h" | 8 #include "chrome/browser/history/history.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // only test collapsing. | 192 // only test collapsing. |
193 options.most_recent_visit_only = true; | 193 options.most_recent_visit_only = true; |
194 QueryHistory(std::wstring(), options, &results); | 194 QueryHistory(std::wstring(), options, &results); |
195 EXPECT_EQ(4U, results.size()); | 195 EXPECT_EQ(4U, results.size()); |
196 EXPECT_TRUE(NthResultIs(results, 0, 4)); | 196 EXPECT_TRUE(NthResultIs(results, 0, 4)); |
197 EXPECT_TRUE(NthResultIs(results, 1, 2)); | 197 EXPECT_TRUE(NthResultIs(results, 1, 2)); |
198 EXPECT_TRUE(NthResultIs(results, 2, 3)); | 198 EXPECT_TRUE(NthResultIs(results, 2, 3)); |
199 EXPECT_TRUE(NthResultIs(results, 3, 1)); | 199 EXPECT_TRUE(NthResultIs(results, 3, 1)); |
200 } | 200 } |
201 | 201 |
| 202 TEST_F(HistoryQueryTest, ReachedBeginning) { |
| 203 ASSERT_TRUE(history_.get()); |
| 204 |
| 205 QueryOptions options; |
| 206 QueryResults results; |
| 207 |
| 208 QueryHistory(std::wstring(), options, &results); |
| 209 EXPECT_TRUE(results.reached_beginning()); |
| 210 |
| 211 options.begin_time = test_entries[1].time; |
| 212 QueryHistory(std::wstring(), options, &results); |
| 213 EXPECT_FALSE(results.reached_beginning()); |
| 214 |
| 215 options.begin_time = test_entries[0].time + TimeDelta::FromMicroseconds(1); |
| 216 QueryHistory(std::wstring(), options, &results); |
| 217 EXPECT_FALSE(results.reached_beginning()); |
| 218 |
| 219 options.begin_time = test_entries[0].time; |
| 220 QueryHistory(std::wstring(), options, &results); |
| 221 EXPECT_TRUE(results.reached_beginning()); |
| 222 |
| 223 options.begin_time = test_entries[0].time - TimeDelta::FromMicroseconds(1); |
| 224 QueryHistory(std::wstring(), options, &results); |
| 225 EXPECT_TRUE(results.reached_beginning()); |
| 226 } |
| 227 |
202 // This does most of the same tests above, but searches for a FTS string that | 228 // This does most of the same tests above, but searches for a FTS string that |
203 // will match the pages in question. This will trigger a different code path. | 229 // will match the pages in question. This will trigger a different code path. |
204 TEST_F(HistoryQueryTest, FTS) { | 230 TEST_F(HistoryQueryTest, FTS) { |
205 ASSERT_TRUE(history_.get()); | 231 ASSERT_TRUE(history_.get()); |
206 | 232 |
207 QueryOptions options; | 233 QueryOptions options; |
208 QueryResults results; | 234 QueryResults results; |
209 | 235 |
210 // Query all of them to make sure they are there and in order. Note that | 236 // Query all of them to make sure they are there and in order. Note that |
211 // this query will return the starred item twice since we requested all | 237 // this query will return the starred item twice since we requested all |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 | 364 |
339 // Now with collapsing. | 365 // Now with collapsing. |
340 options.most_recent_visit_only = true; | 366 options.most_recent_visit_only = true; |
341 QueryHistory(std::wstring(L"Other"), options, &results); | 367 QueryHistory(std::wstring(L"Other"), options, &results); |
342 EXPECT_EQ(1, results.urls().size()); | 368 EXPECT_EQ(1, results.urls().size()); |
343 EXPECT_TRUE(NthResultIs(results, 0, 4)); | 369 EXPECT_TRUE(NthResultIs(results, 0, 4)); |
344 } | 370 } |
345 */ | 371 */ |
346 | 372 |
347 } // namespace history | 373 } // namespace history |
OLD | NEW |