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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 history_->SetPageTitle(url, base::UTF8ToUTF16(entry.title)); | 160 history_->SetPageTitle(url, base::UTF8ToUTF16(entry.title)); |
161 } | 161 } |
162 | 162 |
163 private: | 163 private: |
164 void SetUp() override { | 164 void SetUp() override { |
165 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 165 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
166 history_dir_ = temp_dir_.path().AppendASCII("HistoryTest"); | 166 history_dir_ = temp_dir_.path().AppendASCII("HistoryTest"); |
167 ASSERT_TRUE(base::CreateDirectory(history_dir_)); | 167 ASSERT_TRUE(base::CreateDirectory(history_dir_)); |
168 | 168 |
169 history_.reset(new HistoryService); | 169 history_.reset(new HistoryService); |
170 if (!history_->Init(TestHistoryDatabaseParamsForPath(history_dir_))) { | 170 if (!history_->Init(std::string(), |
| 171 TestHistoryDatabaseParamsForPath(history_dir_))) { |
171 history_.reset(); // Tests should notice this NULL ptr & fail. | 172 history_.reset(); // Tests should notice this NULL ptr & fail. |
172 return; | 173 return; |
173 } | 174 } |
174 | 175 |
175 // Fill the test data. | 176 // Fill the test data. |
176 Time now = Time::Now().LocalMidnight(); | 177 Time now = Time::Now().LocalMidnight(); |
177 for (size_t i = 0; i < arraysize(test_entries); i++) { | 178 for (size_t i = 0; i < arraysize(test_entries); i++) { |
178 test_entries[i].time = | 179 test_entries[i].time = |
179 now - (test_entries[i].days_ago * TimeDelta::FromDays(1)); | 180 now - (test_entries[i].days_ago * TimeDelta::FromDays(1)); |
180 AddEntryToHistory(test_entries[i]); | 181 AddEntryToHistory(test_entries[i]); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 424 |
424 TEST_F(HistoryQueryTest, TextSearchPaging) { | 425 TEST_F(HistoryQueryTest, TextSearchPaging) { |
425 // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not | 426 // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not |
426 // be de-duplicated. Entry #4 does not contain the text "title", so it | 427 // be de-duplicated. Entry #4 does not contain the text "title", so it |
427 // shouldn't appear. | 428 // shouldn't appear. |
428 int expected_results[] = { 2, 3, 1, 7, 6, 5 }; | 429 int expected_results[] = { 2, 3, 1, 7, 6, 5 }; |
429 TestPaging("title", expected_results, arraysize(expected_results)); | 430 TestPaging("title", expected_results, arraysize(expected_results)); |
430 } | 431 } |
431 | 432 |
432 } // namespace history | 433 } // namespace history |
OLD | NEW |