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