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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_)); |
164 | 164 |
165 history_.reset(new HistoryService); | 165 history_.reset(new HistoryService); |
166 if (!history_->Init(history_dir_, NULL)) { | 166 if (!history_->Init(history_dir_)) { |
167 history_.reset(); // Tests should notice this NULL ptr & fail. | 167 history_.reset(); // Tests should notice this NULL ptr & fail. |
168 return; | 168 return; |
169 } | 169 } |
170 | 170 |
171 // Fill the test data. | 171 // Fill the test data. |
172 Time now = Time::Now().LocalMidnight(); | 172 Time now = Time::Now().LocalMidnight(); |
173 for (size_t i = 0; i < arraysize(test_entries); i++) { | 173 for (size_t i = 0; i < arraysize(test_entries); i++) { |
174 test_entries[i].time = | 174 test_entries[i].time = |
175 now - (test_entries[i].days_ago * TimeDelta::FromDays(1)); | 175 now - (test_entries[i].days_ago * TimeDelta::FromDays(1)); |
176 AddEntryToHistory(test_entries[i]); | 176 AddEntryToHistory(test_entries[i]); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 | 479 |
480 TEST_F(HistoryQueryTest, TextSearchPaging) { | 480 TEST_F(HistoryQueryTest, TextSearchPaging) { |
481 // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not | 481 // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not |
482 // be de-duplicated. Entry #4 does not contain the text "title", so it | 482 // be de-duplicated. Entry #4 does not contain the text "title", so it |
483 // shouldn't appear. | 483 // shouldn't appear. |
484 int expected_results[] = { 2, 3, 1, 7, 6, 5 }; | 484 int expected_results[] = { 2, 3, 1, 7, 6, 5 }; |
485 TestPaging("title", expected_results, arraysize(expected_results)); | 485 TestPaging("title", expected_results, arraysize(expected_results)); |
486 } | 486 } |
487 | 487 |
488 } // namespace history | 488 } // namespace history |
OLD | NEW |