| Index: components/omnibox/browser/scored_history_match_unittest.cc
|
| diff --git a/components/omnibox/browser/scored_history_match_unittest.cc b/components/omnibox/browser/scored_history_match_unittest.cc
|
| index d0ad21a618d99e26f48809a02c33a242631fa74c..8c430f0085d3717cbdef4337b2afcb106e15d65b 100644
|
| --- a/components/omnibox/browser/scored_history_match_unittest.cc
|
| +++ b/components/omnibox/browser/scored_history_match_unittest.cc
|
| @@ -244,6 +244,39 @@ TEST_F(ScoredHistoryMatchTest, ScoringTLD) {
|
| EXPECT_GT(scored_with_tld.raw_score, 0);
|
| }
|
|
|
| +TEST_F(ScoredHistoryMatchTest, ScoringPort) {
|
| + // Reset the topicality threshold to 0, otherwise the port matches will not
|
| + // score above the minimum to be returned.
|
| + base::AutoReset<float> reset(&ScoredHistoryMatch::topicality_threshold_, 0.0);
|
| +
|
| + // We use NowFromSystemTime() because MakeURLRow uses the same function
|
| + // to calculate last visit time when building a row.
|
| + base::Time now = base::Time::NowFromSystemTime();
|
| +
|
| + // The URL should be returned with a positive score for a query that includes
|
| + // "8000".
|
| + std::string url_string("http://fedcba.com:8000/");
|
| + GURL url(url_string);
|
| + history::URLRow row(MakeURLRow(url_string.c_str(), "", 8, 3, 1));
|
| + RowWordStarts word_starts;
|
| + PopulateWordStarts(row, &word_starts);
|
| + WordStarts one_word_no_offsets(1, 0u);
|
| + VisitInfoVector visits = CreateVisitInfoVector(8, 3, now);
|
| + ScoredHistoryMatch scored(row, visits, ASCIIToUTF16("8000"),
|
| + Make1Term("8000"), one_word_no_offsets,
|
| + word_starts, false, nullptr, now);
|
| + EXPECT_GT(scored.raw_score, 0);
|
| +
|
| + // Ditto for intranet URLs.
|
| + url_string = "http://fedcba:8000/";
|
| + url = GURL(url_string);
|
| + row = MakeURLRow(url_string.c_str(), "", 8, 3, 1);
|
| + scored = ScoredHistoryMatch(row, visits, ASCIIToUTF16("8000"),
|
| + Make1Term("8000"), one_word_no_offsets,
|
| + word_starts, false, nullptr, now);
|
| + EXPECT_GT(scored.raw_score, 0);
|
| +}
|
| +
|
| TEST_F(ScoredHistoryMatchTest, ScoringScheme) {
|
| // We use NowFromSystemTime() because MakeURLRow uses the same function
|
| // to calculate last visit time when building a row.
|
|
|