| Index: chrome/browser/autocomplete/in_memory_url_index_unittest.cc
|
| diff --git a/chrome/browser/autocomplete/in_memory_url_index_unittest.cc b/chrome/browser/autocomplete/in_memory_url_index_unittest.cc
|
| index 97d4fb3f8122796b6e634e6e787a4e69f7fdabbe..3ca10e52f25356b6714d8f245081dbe6708b2164 100644
|
| --- a/chrome/browser/autocomplete/in_memory_url_index_unittest.cc
|
| +++ b/chrome/browser/autocomplete/in_memory_url_index_unittest.cc
|
| @@ -16,7 +16,6 @@
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "chrome/browser/autocomplete/in_memory_url_index.h"
|
| #include "chrome/browser/autocomplete/in_memory_url_index_types.h"
|
| -#include "chrome/browser/autocomplete/scored_history_match_builder_impl.h"
|
| #include "chrome/browser/autocomplete/url_index_private_data.h"
|
| #include "chrome/browser/bookmarks/bookmark_model_factory.h"
|
| #include "chrome/browser/history/history_service_factory.h"
|
| @@ -128,7 +127,6 @@ class InMemoryURLIndexTest : public testing::Test {
|
| void ExpectPrivateDataEqual(const URLIndexPrivateData& expected,
|
| const URLIndexPrivateData& actual);
|
|
|
| - ScoredHistoryMatchBuilderImpl builder_;
|
| content::TestBrowserThreadBundle thread_bundle_;
|
| scoped_ptr<InMemoryURLIndex> url_index_;
|
| TestingProfile profile_;
|
| @@ -137,9 +135,7 @@ class InMemoryURLIndexTest : public testing::Test {
|
| };
|
|
|
| InMemoryURLIndexTest::InMemoryURLIndexTest()
|
| - : builder_(ScoredHistoryMatchBuilderImpl::IsBookmarkedCallback()),
|
| - history_service_(nullptr),
|
| - history_database_(nullptr) {
|
| + : history_service_(nullptr), history_database_(nullptr) {
|
| }
|
|
|
| sql::Connection& InMemoryURLIndexTest::GetDB() {
|
| @@ -303,8 +299,8 @@ bool InMemoryURLIndexTest::InitializeInMemoryURLIndexInSetUp() const {
|
|
|
| void InMemoryURLIndexTest::InitializeInMemoryURLIndex() {
|
| DCHECK(!url_index_);
|
| - url_index_.reset(
|
| - new InMemoryURLIndex(history_service_, base::FilePath(), kTestLanguages));
|
| + url_index_.reset(new InMemoryURLIndex(nullptr, history_service_,
|
| + base::FilePath(), kTestLanguages));
|
| url_index_->Init();
|
| url_index_->RebuildFromHistory(history_database_);
|
| }
|
| @@ -481,8 +477,7 @@ TEST_F(LimitedInMemoryURLIndexTest, Initialization) {
|
| TEST_F(InMemoryURLIndexTest, MAYBE_Retrieval) {
|
| // See if a very specific term gives a single result.
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("DrudgeReport"), base::string16::npos, kMaxMatches,
|
| - builder_);
|
| + ASCIIToUTF16("DrudgeReport"), base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
|
|
| // Verify that we got back the result we expected.
|
| @@ -494,8 +489,7 @@ TEST_F(InMemoryURLIndexTest, MAYBE_Retrieval) {
|
| // Make sure a trailing space prevents inline-ability but still results
|
| // in the expected result.
|
| matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("DrudgeReport "),
|
| - base::string16::npos, kMaxMatches,
|
| - builder_);
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(5, matches[0].url_info.id());
|
| EXPECT_EQ("http://drudgereport.com/", matches[0].url_info.url().spec());
|
| @@ -503,16 +497,15 @@ TEST_F(InMemoryURLIndexTest, MAYBE_Retrieval) {
|
| EXPECT_FALSE(matches[0].can_inline);
|
|
|
| // Search which should result in multiple results.
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("drudge"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("drudge"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(2U, matches.size());
|
| // The results should be in descending score order.
|
| EXPECT_GE(matches[0].raw_score, matches[1].raw_score);
|
|
|
| // Search which should result in nearly perfect result.
|
| matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("Nearly Perfect Result"), base::string16::npos, kMaxMatches,
|
| - builder_);
|
| + ASCIIToUTF16("Nearly Perfect Result"), base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| // The results should have a very high score.
|
| EXPECT_GT(matches[0].raw_score, 900);
|
| @@ -524,8 +517,8 @@ TEST_F(InMemoryURLIndexTest, MAYBE_Retrieval) {
|
| EXPECT_FALSE(matches[0].can_inline);
|
|
|
| // Search which should result in very poor result.
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("qui c"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("qui c"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| // The results should have a poor score.
|
| EXPECT_LT(matches[0].raw_score, 500);
|
| @@ -537,16 +530,15 @@ TEST_F(InMemoryURLIndexTest, MAYBE_Retrieval) {
|
| EXPECT_FALSE(matches[0].can_inline);
|
|
|
| // Search which will match at the end of an URL with encoded characters.
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("Mice"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("Mice"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(30, matches[0].url_info.id());
|
| EXPECT_FALSE(matches[0].can_inline);
|
|
|
| // Check that URLs are not escaped an escape time.
|
| matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("1% wikipedia"),
|
| - base::string16::npos, kMaxMatches,
|
| - builder_);
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(35, matches[0].url_info.id());
|
| EXPECT_EQ("http://en.wikipedia.org/wiki/1%25_rule_(Internet_culture)",
|
| @@ -554,8 +546,8 @@ TEST_F(InMemoryURLIndexTest, MAYBE_Retrieval) {
|
|
|
| // Verify that a single term can appear multiple times in the URL and as long
|
| // as one starts the URL it is still inlined.
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("fubar"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("fubar"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(34, matches[0].url_info.id());
|
| EXPECT_EQ("http://fubarfubarandfubar.com/", matches[0].url_info.url().spec());
|
| @@ -567,18 +559,18 @@ TEST_F(InMemoryURLIndexTest, MAYBE_Retrieval) {
|
| TEST_F(InMemoryURLIndexTest, CursorPositionRetrieval) {
|
| // See if a very specific term with no cursor gives an empty result.
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("DrudReport"), base::string16::npos, kMaxMatches, builder_);
|
| + ASCIIToUTF16("DrudReport"), base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(0U, matches.size());
|
|
|
| // The same test with the cursor at the end should give an empty result.
|
| matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("DrudReport"), 10u,
|
| - kMaxMatches, builder_);
|
| + kMaxMatches);
|
| ASSERT_EQ(0U, matches.size());
|
|
|
| // If the cursor is between Drud and Report, we should find the desired
|
| // result.
|
| matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("DrudReport"), 4u,
|
| - kMaxMatches, builder_);
|
| + kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ("http://drudgereport.com/", matches[0].url_info.url().spec());
|
| EXPECT_EQ(ASCIIToUTF16("DRUDGE REPORT 2010"), matches[0].url_info.title());
|
| @@ -586,19 +578,18 @@ TEST_F(InMemoryURLIndexTest, CursorPositionRetrieval) {
|
| // Now check multi-word inputs. No cursor should fail to find a
|
| // result on this input.
|
| matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("MORTGAGERATE DROPS"),
|
| - base::string16::npos, kMaxMatches,
|
| - builder_);
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(0U, matches.size());
|
|
|
| // Ditto with cursor at end.
|
| matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("MORTGAGERATE DROPS"),
|
| - 18u, kMaxMatches, builder_);
|
| + 18u, kMaxMatches);
|
| ASSERT_EQ(0U, matches.size());
|
|
|
| // If the cursor is between MORTAGE And RATE, we should find the
|
| // desired result.
|
| matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("MORTGAGERATE DROPS"),
|
| - 8u, kMaxMatches, builder_);
|
| + 8u, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ("http://www.reuters.com/article/idUSN0839880620100708",
|
| matches[0].url_info.url().spec());
|
| @@ -610,68 +601,67 @@ TEST_F(InMemoryURLIndexTest, CursorPositionRetrieval) {
|
| TEST_F(InMemoryURLIndexTest, URLPrefixMatching) {
|
| // "drudgere" - found, can inline
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("drudgere"), base::string16::npos, kMaxMatches, builder_);
|
| + ASCIIToUTF16("drudgere"), base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_TRUE(matches[0].can_inline);
|
|
|
| // "drudgere" - found, can inline
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("drudgere"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("drudgere"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_TRUE(matches[0].can_inline);
|
|
|
| // "www.atdmt" - not found
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("www.atdmt"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("www.atdmt"),
|
| + base::string16::npos, kMaxMatches);
|
| EXPECT_EQ(0U, matches.size());
|
|
|
| // "atdmt" - found, cannot inline
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("atdmt"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("atdmt"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_FALSE(matches[0].can_inline);
|
|
|
| // "view.atdmt" - found, can inline
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("view.atdmt"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("view.atdmt"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_TRUE(matches[0].can_inline);
|
|
|
| // "view.atdmt" - found, can inline
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("view.atdmt"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("view.atdmt"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_TRUE(matches[0].can_inline);
|
|
|
| // "cnn.com" - found, can inline
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("cnn.com"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("cnn.com"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(2U, matches.size());
|
| // One match should be inline-able, the other not.
|
| EXPECT_TRUE(matches[0].can_inline != matches[1].can_inline);
|
|
|
| // "www.cnn.com" - found, can inline
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("www.cnn.com"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("www.cnn.com"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_TRUE(matches[0].can_inline);
|
|
|
| // "ww.cnn.com" - found because we allow mid-term matches in hostnames
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("ww.cnn.com"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("ww.cnn.com"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
|
|
| // "www.cnn.com" - found, can inline
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("www.cnn.com"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("www.cnn.com"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_TRUE(matches[0].can_inline);
|
|
|
| // "tp://www.cnn.com" - not found because we don't allow tp as a mid-term
|
| // match
|
| matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("tp://www.cnn.com"),
|
| - base::string16::npos, kMaxMatches,
|
| - builder_);
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(0U, matches.size());
|
| }
|
|
|
| @@ -681,13 +671,13 @@ TEST_F(InMemoryURLIndexTest, ProperStringMatching) {
|
| // "atdmt.view" - not found
|
| // "view.atdmt" - found
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("atdmt view"), base::string16::npos, kMaxMatches, builder_);
|
| + ASCIIToUTF16("atdmt view"), base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("atdmt.view"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("atdmt.view"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(0U, matches.size());
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("view.atdmt"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("view.atdmt"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| }
|
|
|
| @@ -701,7 +691,7 @@ TEST_F(InMemoryURLIndexTest, HugeResultSet) {
|
| }
|
|
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("b"), base::string16::npos, kMaxMatches, builder_);
|
| + ASCIIToUTF16("b"), base::string16::npos, kMaxMatches);
|
| URLIndexPrivateData& private_data(*GetPrivateData());
|
| ASSERT_EQ(kMaxMatches, matches.size());
|
| // There are 7 matches already in the database.
|
| @@ -722,8 +712,7 @@ TEST_F(InMemoryURLIndexTest, MAYBE_TitleSearch) {
|
|
|
| // Ensure title is being searched.
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("MORTGAGE RATE DROPS"), base::string16::npos, kMaxMatches,
|
| - builder_);
|
| + ASCIIToUTF16("MORTGAGE RATE DROPS"), base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
|
|
| // Verify that we got back the result we expected.
|
| @@ -740,7 +729,7 @@ TEST_F(InMemoryURLIndexTest, TitleChange) {
|
| base::string16 original_terms =
|
| ASCIIToUTF16("lebronomics could high taxes influence");
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - original_terms, base::string16::npos, kMaxMatches, builder_);
|
| + original_terms, base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
|
|
| // Verify that we got back the result we expected.
|
| @@ -756,7 +745,7 @@ TEST_F(InMemoryURLIndexTest, TitleChange) {
|
| // Verify new title terms retrieves nothing.
|
| base::string16 new_terms = ASCIIToUTF16("does eat oats little lambs ivy");
|
| matches = url_index_->HistoryItemsForTerms(new_terms, base::string16::npos,
|
| - kMaxMatches, builder_);
|
| + kMaxMatches);
|
| ASSERT_EQ(0U, matches.size());
|
|
|
| // Update the row.
|
| @@ -765,11 +754,11 @@ TEST_F(InMemoryURLIndexTest, TitleChange) {
|
|
|
| // Verify we get the row using the new terms but not the original terms.
|
| matches = url_index_->HistoryItemsForTerms(new_terms, base::string16::npos,
|
| - kMaxMatches, builder_);
|
| + kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(expected_id, matches[0].url_info.id());
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - original_terms, base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(original_terms,
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(0U, matches.size());
|
| }
|
|
|
| @@ -777,29 +766,29 @@ TEST_F(InMemoryURLIndexTest, NonUniqueTermCharacterSets) {
|
| // The presence of duplicate characters should succeed. Exercise by cycling
|
| // through a string with several duplicate characters.
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("ABRA"), base::string16::npos, kMaxMatches, builder_);
|
| + ASCIIToUTF16("ABRA"), base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(28, matches[0].url_info.id());
|
| EXPECT_EQ("http://www.ddj.com/windows/184416623",
|
| matches[0].url_info.url().spec());
|
|
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("ABRACAD"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("ABRACAD"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(28, matches[0].url_info.id());
|
|
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("ABRACADABRA"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("ABRACADABRA"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(28, matches[0].url_info.id());
|
|
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("ABRACADABR"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("ABRACADABR"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(28, matches[0].url_info.id());
|
|
|
| - matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("ABRACA"), base::string16::npos, kMaxMatches, builder_);
|
| + matches = url_index_->HistoryItemsForTerms(ASCIIToUTF16("ABRACA"),
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
| EXPECT_EQ(28, matches[0].url_info.id());
|
| }
|
| @@ -821,14 +810,14 @@ TEST_F(InMemoryURLIndexTest, TypedCharacterCaching) {
|
| // Simulate typing "r" giving "r" in the simulated omnibox. The results for
|
| // 'r' will be not cached because it is only 1 character long.
|
| url_index_->HistoryItemsForTerms(ASCIIToUTF16("r"), base::string16::npos,
|
| - kMaxMatches, builder_);
|
| + kMaxMatches);
|
| EXPECT_EQ(0U, cache.size());
|
|
|
| // Simulate typing "re" giving "r re" in the simulated omnibox.
|
| // 're' should be cached at this point but not 'r' as it is a single
|
| // character.
|
| url_index_->HistoryItemsForTerms(ASCIIToUTF16("r re"), base::string16::npos,
|
| - kMaxMatches, builder_);
|
| + kMaxMatches);
|
| ASSERT_EQ(1U, cache.size());
|
| CheckTerm(cache, ASCIIToUTF16("re"));
|
|
|
| @@ -836,7 +825,7 @@ TEST_F(InMemoryURLIndexTest, TypedCharacterCaching) {
|
| // 're' and 'reco' should be cached at this point but not 'r' as it is a
|
| // single character.
|
| url_index_->HistoryItemsForTerms(ASCIIToUTF16("r re reco"),
|
| - base::string16::npos, kMaxMatches, builder_);
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(2U, cache.size());
|
| CheckTerm(cache, ASCIIToUTF16("re"));
|
| CheckTerm(cache, ASCIIToUTF16("reco"));
|
| @@ -845,20 +834,20 @@ TEST_F(InMemoryURLIndexTest, TypedCharacterCaching) {
|
| // Since we now have only one search term, the cached results for 're' and
|
| // 'reco' should be purged, giving us only 1 item in the cache (for 'mort').
|
| url_index_->HistoryItemsForTerms(ASCIIToUTF16("mort"), base::string16::npos,
|
| - kMaxMatches, builder_);
|
| + kMaxMatches);
|
| ASSERT_EQ(1U, cache.size());
|
| CheckTerm(cache, ASCIIToUTF16("mort"));
|
|
|
| // Simulate typing "reco" giving "mort reco" in the simulated omnibox.
|
| url_index_->HistoryItemsForTerms(ASCIIToUTF16("mort reco"),
|
| - base::string16::npos, kMaxMatches, builder_);
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(2U, cache.size());
|
| CheckTerm(cache, ASCIIToUTF16("mort"));
|
| CheckTerm(cache, ASCIIToUTF16("reco"));
|
|
|
| // Simulate a <DELETE> by removing the 'reco' and adding back the 'rec'.
|
| url_index_->HistoryItemsForTerms(ASCIIToUTF16("mort rec"),
|
| - base::string16::npos, kMaxMatches, builder_);
|
| + base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(2U, cache.size());
|
| CheckTerm(cache, ASCIIToUTF16("mort"));
|
| CheckTerm(cache, ASCIIToUTF16("rec"));
|
| @@ -872,7 +861,7 @@ TEST_F(InMemoryURLIndexTest, AddNewRows) {
|
| // qualify as a quick result candidate.
|
| EXPECT_TRUE(url_index_->HistoryItemsForTerms(ASCIIToUTF16("brokeandalone"),
|
| base::string16::npos,
|
| - kMaxMatches, builder_).empty());
|
| + kMaxMatches).empty());
|
|
|
| // Add a new row.
|
| history::URLRow new_row(GURL("http://www.brokeandaloneinmanitoba.com/"),
|
| @@ -883,14 +872,14 @@ TEST_F(InMemoryURLIndexTest, AddNewRows) {
|
| // Verify that we can retrieve it.
|
| EXPECT_EQ(1U, url_index_->HistoryItemsForTerms(ASCIIToUTF16("brokeandalone"),
|
| base::string16::npos,
|
| - kMaxMatches, builder_).size());
|
| + kMaxMatches).size());
|
|
|
| // Add it again just to be sure that is harmless and that it does not update
|
| // the index.
|
| EXPECT_FALSE(UpdateURL(new_row));
|
| EXPECT_EQ(1U, url_index_->HistoryItemsForTerms(ASCIIToUTF16("brokeandalone"),
|
| base::string16::npos,
|
| - kMaxMatches, builder_).size());
|
| + kMaxMatches).size());
|
|
|
| // Make up an URL that does not qualify and try to add it.
|
| history::URLRow unqualified_row(
|
| @@ -900,15 +889,14 @@ TEST_F(InMemoryURLIndexTest, AddNewRows) {
|
|
|
| TEST_F(InMemoryURLIndexTest, DeleteRows) {
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("DrudgeReport"), base::string16::npos, kMaxMatches,
|
| - builder_);
|
| + ASCIIToUTF16("DrudgeReport"), base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
|
|
| // Delete the URL then search again.
|
| EXPECT_TRUE(DeleteURL(matches[0].url_info.url()));
|
| EXPECT_TRUE(url_index_->HistoryItemsForTerms(ASCIIToUTF16("DrudgeReport"),
|
| base::string16::npos,
|
| - kMaxMatches, builder_).empty());
|
| + kMaxMatches).empty());
|
|
|
| // Make up an URL that does not exist in the database and delete it.
|
| GURL url("http://www.hokeypokey.com/putyourrightfootin.html");
|
| @@ -917,8 +905,7 @@ TEST_F(InMemoryURLIndexTest, DeleteRows) {
|
|
|
| TEST_F(InMemoryURLIndexTest, ExpireRow) {
|
| ScoredHistoryMatches matches = url_index_->HistoryItemsForTerms(
|
| - ASCIIToUTF16("DrudgeReport"), base::string16::npos, kMaxMatches,
|
| - builder_);
|
| + ASCIIToUTF16("DrudgeReport"), base::string16::npos, kMaxMatches);
|
| ASSERT_EQ(1U, matches.size());
|
|
|
| // Determine the row id for the result, remember that id, broadcast a
|
| @@ -929,7 +916,7 @@ TEST_F(InMemoryURLIndexTest, ExpireRow) {
|
| std::set<GURL>());
|
| EXPECT_TRUE(url_index_->HistoryItemsForTerms(ASCIIToUTF16("DrudgeReport"),
|
| base::string16::npos,
|
| - kMaxMatches, builder_).empty());
|
| + kMaxMatches).empty());
|
| }
|
|
|
| TEST_F(InMemoryURLIndexTest, WhitelistedURLs) {
|
| @@ -1225,7 +1212,8 @@ class InMemoryURLIndexCacheTest : public testing::Test {
|
| void InMemoryURLIndexCacheTest::SetUp() {
|
| ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
|
| base::FilePath path(temp_dir_.path());
|
| - url_index_.reset(new InMemoryURLIndex(nullptr, path, kTestLanguages));
|
| + url_index_.reset(
|
| + new InMemoryURLIndex(nullptr, nullptr, path, kTestLanguages));
|
| }
|
|
|
| void InMemoryURLIndexCacheTest::TearDown() {
|
|
|