| 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..ef1f9bb44c1cf603f5274367ba389f26a2e5e5da 100644
|
| --- a/chrome/browser/history/scored_history_match_unittest.cc
|
| +++ b/chrome/browser/history/scored_history_match_unittest.cc
|
| @@ -344,6 +344,57 @@ 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;
|
| + // hqp_relevance_buckets = "1.5:600,12.0:1300,20.0:1399";
|
| + std::vector<ScoredHistoryMatch::ScoreMaxRelevance> hqp_buckets;
|
| + hqp_buckets.push_back(std::make_pair(1.5, 600));
|
| + hqp_buckets.push_back(std::make_pair(12.0, 1300));
|
| + hqp_buckets.push_back(std::make_pair(20.0, 1399));
|
| + EXPECT_EQ(1337,
|
| + scored_match.GetFinalRelevancyScore(topicality_score,
|
| + frequency_score,
|
| + hqp_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";
|
| + hqp_buckets.clear();
|
| + hqp_buckets.push_back(std::make_pair(1, 200));
|
| + hqp_buckets.push_back(std::make_pair(4, 500));
|
| + hqp_buckets.push_back(std::make_pair(5, 900));
|
| + hqp_buckets.push_back(std::make_pair(10, 1000));
|
| + EXPECT_EQ(900,
|
| + scored_match.GetFinalRelevancyScore(topicality_score,
|
| + frequency_score,
|
| + hqp_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";
|
| + hqp_buckets.clear();
|
| + hqp_buckets.push_back(std::make_pair(1, 200));
|
| + hqp_buckets.push_back(std::make_pair(4, 500));
|
| + hqp_buckets.push_back(std::make_pair(8, 900));
|
| + hqp_buckets.push_back(std::make_pair(10, 1000));
|
| + EXPECT_EQ(600, // 500 + (((900 - 500)/(8 -4)) * 1) = 600.
|
| + scored_match.GetFinalRelevancyScore(topicality_score,
|
| + frequency_score,
|
| + hqp_buckets));
|
| + // Never give the score greater than maximum specified.
|
| + topicality_score = 0.5;
|
| + frequency_score = 22.0;
|
| + // hqp_relevance_buckets unchanged.
|
| + EXPECT_EQ(1000,
|
| + scored_match.GetFinalRelevancyScore(topicality_score,
|
| + frequency_score,
|
| + hqp_buckets));
|
| +}
|
| +
|
| // This function only tests scoring of single terms that match exactly
|
| // once somewhere in the URL or title.
|
| TEST_F(ScoredHistoryMatchTest, GetTopicalityScore) {
|
|
|