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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 history_->AddPage(url, entry.time, id_scope, page_id_++, GURL(), | 152 history_->AddPage(url, entry.time, id_scope, page_id_++, GURL(), |
153 history::RedirectList(), content::PAGE_TRANSITION_LINK, | 153 history::RedirectList(), content::PAGE_TRANSITION_LINK, |
154 history::SOURCE_BROWSED, false); | 154 history::SOURCE_BROWSED, false); |
155 history_->SetPageTitle(url, UTF8ToUTF16(entry.title)); | 155 history_->SetPageTitle(url, UTF8ToUTF16(entry.title)); |
156 } | 156 } |
157 | 157 |
158 private: | 158 private: |
159 virtual void SetUp() { | 159 virtual void SetUp() { |
160 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 160 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
161 history_dir_ = temp_dir_.path().AppendASCII("HistoryTest"); | 161 history_dir_ = temp_dir_.path().AppendASCII("HistoryTest"); |
162 ASSERT_TRUE(file_util::CreateDirectory(history_dir_)); | 162 ASSERT_TRUE(base::CreateDirectory(history_dir_)); |
163 | 163 |
164 history_.reset(new HistoryService); | 164 history_.reset(new HistoryService); |
165 if (!history_->Init(history_dir_, NULL)) { | 165 if (!history_->Init(history_dir_, NULL)) { |
166 history_.reset(); // Tests should notice this NULL ptr & fail. | 166 history_.reset(); // Tests should notice this NULL ptr & fail. |
167 return; | 167 return; |
168 } | 168 } |
169 | 169 |
170 // Fill the test data. | 170 // Fill the test data. |
171 Time now = Time::Now().LocalMidnight(); | 171 Time now = Time::Now().LocalMidnight(); |
172 for (size_t i = 0; i < arraysize(test_entries); i++) { | 172 for (size_t i = 0; i < arraysize(test_entries); i++) { |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 TEST_F(HistoryQueryTest, TextSearchPaging) { | 479 TEST_F(HistoryQueryTest, TextSearchPaging) { |
480 // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not | 480 // Since results are fetched 1 and 2 at a time, entry #0 and #6 will not |
481 // be de-duplicated. Entry #4 does not contain the text "title", so it | 481 // be de-duplicated. Entry #4 does not contain the text "title", so it |
482 // shouldn't appear. | 482 // shouldn't appear. |
483 int expected_results[] = { 2, 3, 1, 7, 6, 5 }; | 483 int expected_results[] = { 2, 3, 1, 7, 6, 5 }; |
484 TestPaging("title", expected_results, arraysize(expected_results)); | 484 TestPaging("title", expected_results, arraysize(expected_results)); |
485 } | 485 } |
486 | 486 |
487 } // namespace history | 487 } // namespace history |
OLD | NEW |