| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include <fstream> | 7 #include <fstream> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 // A search for 'working' should not short-circuit. | 290 // A search for 'working' should not short-circuit. |
| 291 matches = url_index_->HistoryItemsForTerms(Make1Term("working")); | 291 matches = url_index_->HistoryItemsForTerms(Make1Term("working")); |
| 292 EXPECT_EQ(1U, matches.size()); | 292 EXPECT_EQ(1U, matches.size()); |
| 293 } | 293 } |
| 294 | 294 |
| 295 TEST_F(InMemoryURLIndexTest, TitleSearch) { | 295 TEST_F(InMemoryURLIndexTest, TitleSearch) { |
| 296 url_index_.reset(new InMemoryURLIndex()); | 296 url_index_.reset(new InMemoryURLIndex()); |
| 297 url_index_->Init(this, "en,ja,hi,zh"); | 297 url_index_->Init(this, "en,ja,hi,zh"); |
| 298 // Signal if someone has changed the test DB. | 298 // Signal if someone has changed the test DB. |
| 299 EXPECT_EQ(25U, url_index_->history_info_map_.size()); | 299 EXPECT_EQ(27U, url_index_->history_info_map_.size()); |
| 300 InMemoryURLIndex::String16Vector terms; | 300 InMemoryURLIndex::String16Vector terms; |
| 301 | 301 |
| 302 // Ensure title is being searched. | 302 // Ensure title is being searched. |
| 303 terms.push_back(ASCIIToUTF16("MORTGAGE")); | 303 terms.push_back(ASCIIToUTF16("MORTGAGE")); |
| 304 terms.push_back(ASCIIToUTF16("RATE")); | 304 terms.push_back(ASCIIToUTF16("RATE")); |
| 305 terms.push_back(ASCIIToUTF16("DROPS")); | 305 terms.push_back(ASCIIToUTF16("DROPS")); |
| 306 ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(terms); | 306 ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(terms); |
| 307 ASSERT_EQ(1U, matches.size()); | 307 ASSERT_EQ(1U, matches.size()); |
| 308 | 308 |
| 309 // Verify that we got back the result we expected. | 309 // Verify that we got back the result we expected. |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 770 const URLRow& expected_row(expected->second); | 770 const URLRow& expected_row(expected->second); |
| 771 const URLRow& actual_row(actual->second); | 771 const URLRow& actual_row(actual->second); |
| 772 EXPECT_EQ(expected_row.visit_count(), actual_row.visit_count()); | 772 EXPECT_EQ(expected_row.visit_count(), actual_row.visit_count()); |
| 773 EXPECT_EQ(expected_row.typed_count(), actual_row.typed_count()); | 773 EXPECT_EQ(expected_row.typed_count(), actual_row.typed_count()); |
| 774 EXPECT_EQ(expected_row.last_visit(), actual_row.last_visit()); | 774 EXPECT_EQ(expected_row.last_visit(), actual_row.last_visit()); |
| 775 EXPECT_EQ(expected_row.url(), actual_row.url()); | 775 EXPECT_EQ(expected_row.url(), actual_row.url()); |
| 776 } | 776 } |
| 777 } | 777 } |
| 778 | 778 |
| 779 } // namespace history | 779 } // namespace history |
| OLD | NEW |