Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: components/omnibox/browser/scored_history_match_unittest.cc

Issue 1286093006: Launch HQP & HUP score changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/omnibox/browser/scored_history_match.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/omnibox/browser/scored_history_match.h" 5 #include "components/omnibox/browser/scored_history_match.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 float ScoredHistoryMatchTest::GetTopicalityScoreOfTermAgainstURLAndTitle( 104 float ScoredHistoryMatchTest::GetTopicalityScoreOfTermAgainstURLAndTitle(
105 const base::string16& term, 105 const base::string16& term,
106 const base::string16& url, 106 const base::string16& url,
107 const base::string16& title) { 107 const base::string16& title) {
108 // Make an empty match and simply populate the fields we need in order 108 // Make an empty match and simply populate the fields we need in order
109 // to call GetTopicalityScore(). 109 // to call GetTopicalityScore().
110 ScoredHistoryMatch scored_match; 110 ScoredHistoryMatch scored_match;
111 scored_match.url_matches = MatchTermInString(term, url, 0); 111 scored_match.url_matches = MatchTermInString(term, url, 0);
112 scored_match.title_matches = MatchTermInString(term, title, 0); 112 scored_match.title_matches = MatchTermInString(term, title, 0);
113 scored_match.topicality_threshold_ = -1;
113 RowWordStarts word_starts; 114 RowWordStarts word_starts;
114 String16SetFromString16(url, &word_starts.url_word_starts_); 115 String16SetFromString16(url, &word_starts.url_word_starts_);
115 String16SetFromString16(title, &word_starts.title_word_starts_); 116 String16SetFromString16(title, &word_starts.title_word_starts_);
116 WordStarts one_word_no_offset(1, 0u); 117 WordStarts one_word_no_offset(1, 0u);
117 return scored_match.GetTopicalityScore(1, url, one_word_no_offset, 118 return scored_match.GetTopicalityScore(1, url, one_word_no_offset,
118 word_starts); 119 word_starts);
119 } 120 }
120 121
121 TEST_F(ScoredHistoryMatchTest, Scoring) { 122 TEST_F(ScoredHistoryMatchTest, Scoring) {
122 // We use NowFromSystemTime() because MakeURLRow uses the same function 123 // We use NowFromSystemTime() because MakeURLRow uses the same function
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 484
484 EXPECT_TRUE( 485 EXPECT_TRUE(
485 ScoredHistoryMatch::GetHQPBucketsFromString(buckets_str, &hqp_buckets)); 486 ScoredHistoryMatch::GetHQPBucketsFromString(buckets_str, &hqp_buckets));
486 EXPECT_THAT(hqp_buckets, ElementsAre(Pair(0.0, 400), Pair(1.5, 600), 487 EXPECT_THAT(hqp_buckets, ElementsAre(Pair(0.0, 400), Pair(1.5, 600),
487 Pair(12.0, 1300), Pair(20.0, 1399))); 488 Pair(12.0, 1300), Pair(20.0, 1399)));
488 // invalid string. 489 // invalid string.
489 buckets_str = "0.0,400,1.5,600"; 490 buckets_str = "0.0,400,1.5,600";
490 EXPECT_FALSE( 491 EXPECT_FALSE(
491 ScoredHistoryMatch::GetHQPBucketsFromString(buckets_str, &hqp_buckets)); 492 ScoredHistoryMatch::GetHQPBucketsFromString(buckets_str, &hqp_buckets));
492 } 493 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/scored_history_match.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698