Chromium Code Reviews| 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) { |