| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 | 141 |
| 142 protected: | 142 protected: |
| 143 scoped_ptr<HistoryService> history_; | 143 scoped_ptr<HistoryService> history_; |
| 144 | 144 |
| 145 // Counter used to generate a unique ID for each page added to the history. | 145 // Counter used to generate a unique ID for each page added to the history. |
| 146 int32 page_id_; | 146 int32 page_id_; |
| 147 | 147 |
| 148 void AddEntryToHistory(const TestEntry& entry) { | 148 void AddEntryToHistory(const TestEntry& entry) { |
| 149 // We need the ID scope and page ID so that the visit tracker can find it. | 149 // We need the ID scope and page ID so that the visit tracker can find it. |
| 150 const void* id_scope = reinterpret_cast<void*>(1); | 150 ContextID context_id = reinterpret_cast<ContextID>(1); |
| 151 GURL url(entry.url); | 151 GURL url(entry.url); |
| 152 | 152 |
| 153 history_->AddPage(url, entry.time, id_scope, page_id_++, GURL(), | 153 history_->AddPage(url, entry.time, context_id, page_id_++, GURL(), |
| 154 history::RedirectList(), content::PAGE_TRANSITION_LINK, | 154 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
| 155 history::SOURCE_BROWSED, false); | 155 history::SOURCE_BROWSED, false); |
| 156 history_->SetPageTitle(url, base::UTF8ToUTF16(entry.title)); | 156 history_->SetPageTitle(url, base::UTF8ToUTF16(entry.title)); |
| 157 } | 157 } |
| 158 | 158 |
| 159 private: | 159 private: |
| 160 virtual void SetUp() { | 160 virtual void SetUp() { |
| 161 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 161 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 162 history_dir_ = temp_dir_.path().AppendASCII("HistoryTest"); | 162 history_dir_ = temp_dir_.path().AppendASCII("HistoryTest"); |
| 163 ASSERT_TRUE(base::CreateDirectory(history_dir_)); | 163 ASSERT_TRUE(base::CreateDirectory(history_dir_)); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 | 419 |
| 420 TEST_F(HistoryQueryTest, TextSearchPaging) { | 420 TEST_F(HistoryQueryTest, TextSearchPaging) { |
| 421 // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not | 421 // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not |
| 422 // be de-duplicated. Entry #4 does not contain the text "title", so it | 422 // be de-duplicated. Entry #4 does not contain the text "title", so it |
| 423 // shouldn't appear. | 423 // shouldn't appear. |
| 424 int expected_results[] = { 2, 3, 1, 7, 6, 5 }; | 424 int expected_results[] = { 2, 3, 1, 7, 6, 5 }; |
| 425 TestPaging("title", expected_results, arraysize(expected_results)); | 425 TestPaging("title", expected_results, arraysize(expected_results)); |
| 426 } | 426 } |
| 427 | 427 |
| 428 } // namespace history | 428 } // namespace history |
| OLD | NEW |