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

Unified Diff: chrome/browser/history/scored_history_match_unittest.cc

Issue 905023003: Adding knobs on HQP provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Initial Change to control HQP scoring. Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/history/scored_history_match_unittest.cc
diff --git a/chrome/browser/history/scored_history_match_unittest.cc b/chrome/browser/history/scored_history_match_unittest.cc
index 4989966eda6eb271a3c5cc935a26e39dae626d98..b1efbba6ce7195ff87928b1c02a2c686eadc0328 100644
--- a/chrome/browser/history/scored_history_match_unittest.cc
+++ b/chrome/browser/history/scored_history_match_unittest.cc
@@ -344,6 +344,43 @@ TEST_F(ScoredHistoryMatchTest, GetTopicalityScoreTrailingSlash) {
EXPECT_EQ(hostname_no_slash, hostname);
}
+// This function tests the final-relevancy score.
+TEST_F(ScoredHistoryMatchTest, GetFinalRelevancyScore) {
+ ScoredHistoryMatch scored_match;
+ // Checking the scores at maximum range.
+ float topicality_score = 1.0;
+ float frequency_score = 15.0;
+ std::string hqp_relevance_buckets = "1.5:600,12.0:1300,20.0:1399";
+ EXPECT_EQ(1337,
+ scored_match.GetFinalRelevancyScore(topicality_score,
+ frequency_score,
+ hqp_relevance_buckets));
+ // Checking the scores at border line.
+ topicality_score = 0.5;
+ frequency_score = 10.0;
+ hqp_relevance_buckets = "1:200,4:500,5:900,10:1000";
+ EXPECT_EQ(900,
+ scored_match.GetFinalRelevancyScore(topicality_score,
+ frequency_score,
+ hqp_relevance_buckets));
+ // Checking the score of intermediate.
+ topicality_score = 0.5;
+ frequency_score = 10.0;
+ hqp_relevance_buckets = "1:200,4:500,8:900,10:1000";
+ EXPECT_EQ(600, // 500 + (((900 - 500)/(8 -4)) * 1) = 600.
Bart N. 2015/02/10 01:22:30 Extra space after , (at least 2 spaces).
Ashok vardhan 2015/02/10 23:57:45 Done.
+ scored_match.GetFinalRelevancyScore(topicality_score,
+ frequency_score,
+ hqp_relevance_buckets));
+ // Never give the score greater than maximum specified.
+ topicality_score = 0.5;
+ frequency_score = 22.0;
+ hqp_relevance_buckets = "1:200,4:500,8:900,10:1000";
+ EXPECT_EQ(1000,
+ scored_match.GetFinalRelevancyScore(topicality_score,
+ frequency_score,
+ hqp_relevance_buckets));
+}
+
// This function only tests scoring of single terms that match exactly
// once somewhere in the URL or title.
TEST_F(ScoredHistoryMatchTest, GetTopicalityScore) {

Powered by Google App Engine
This is Rietveld 408576698