| 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_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "chrome/browser/history/history.h" | 9 #include "chrome/browser/history/history.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 for (size_t i = 0; i < arraysize(test_entries); i++) { | 101 for (size_t i = 0; i < arraysize(test_entries); i++) { |
| 102 test_entries[i].time = | 102 test_entries[i].time = |
| 103 now - (test_entries[i].days_ago * TimeDelta::FromDays(1)); | 103 now - (test_entries[i].days_ago * TimeDelta::FromDays(1)); |
| 104 | 104 |
| 105 // We need the ID scope and page ID so that the visit tracker can find it. | 105 // We need the ID scope and page ID so that the visit tracker can find it. |
| 106 const void* id_scope = reinterpret_cast<void*>(1); | 106 const void* id_scope = reinterpret_cast<void*>(1); |
| 107 int32 page_id = i; | 107 int32 page_id = i; |
| 108 GURL url(test_entries[i].url); | 108 GURL url(test_entries[i].url); |
| 109 | 109 |
| 110 history_->AddPage(url, test_entries[i].time, id_scope, page_id, GURL(), | 110 history_->AddPage(url, test_entries[i].time, id_scope, page_id, GURL(), |
| 111 PageTransition::LINK, HistoryService::RedirectList()); | 111 PageTransition::LINK, HistoryService::RedirectList(), |
| 112 false); |
| 112 history_->SetPageTitle(url, test_entries[i].title); | 113 history_->SetPageTitle(url, test_entries[i].title); |
| 113 history_->SetPageContents(url, test_entries[i].body); | 114 history_->SetPageContents(url, test_entries[i].body); |
| 114 } | 115 } |
| 115 } | 116 } |
| 116 | 117 |
| 117 virtual void TearDown() { | 118 virtual void TearDown() { |
| 118 if (history_.get()) { | 119 if (history_.get()) { |
| 119 history_->SetOnBackendDestroyTask(new MessageLoop::QuitTask); | 120 history_->SetOnBackendDestroyTask(new MessageLoop::QuitTask); |
| 120 history_->Cleanup(); | 121 history_->Cleanup(); |
| 121 history_ = NULL; | 122 history_ = NULL; |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 367 |
| 367 // Now with collapsing. | 368 // Now with collapsing. |
| 368 options.most_recent_visit_only = true; | 369 options.most_recent_visit_only = true; |
| 369 QueryHistory(std::wstring(L"Other"), options, &results); | 370 QueryHistory(std::wstring(L"Other"), options, &results); |
| 370 EXPECT_EQ(1, results.urls().size()); | 371 EXPECT_EQ(1, results.urls().size()); |
| 371 EXPECT_TRUE(NthResultIs(results, 0, 4)); | 372 EXPECT_TRUE(NthResultIs(results, 0, 4)); |
| 372 } | 373 } |
| 373 */ | 374 */ |
| 374 | 375 |
| 375 } // namespace history | 376 } // namespace history |
| OLD | NEW |