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