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

Side by Side Diff: chrome/browser/autocomplete/history_url_provider_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
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/history_url_provider.h" 5 #include "components/omnibox/browser/history_url_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 sort_matches_ = true; 746 sort_matches_ = true;
747 747
748 const UrlAndLegalDefault expected1[] = { 748 const UrlAndLegalDefault expected1[] = {
749 { "http://intra/three", true }, 749 { "http://intra/three", true },
750 { "http://intra/two", true } 750 { "http://intra/two", true }
751 }; 751 };
752 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("intra/t"), std::string(), false, 752 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("intra/t"), std::string(), false,
753 expected1, arraysize(expected1))); 753 expected1, arraysize(expected1)));
754 EXPECT_LE(1410, matches_[0].relevance); 754 EXPECT_LE(1410, matches_[0].relevance);
755 EXPECT_LT(matches_[0].relevance, 1420); 755 EXPECT_LT(matches_[0].relevance, 1420);
756 EXPECT_EQ(matches_[0].relevance - 1, matches_[1].relevance); 756 // It uses the default scoring.
757 EXPECT_EQ(matches_[1].relevance, 1203);
757 758
758 const UrlAndLegalDefault expected2[] = { 759 const UrlAndLegalDefault expected2[] = {
759 { "http://moo/b", true }, 760 { "http://moo/b", true },
760 { "http://moo/bar", true } 761 { "http://moo/bar", true }
761 }; 762 };
762 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("moo/b"), std::string(), false, 763 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16("moo/b"), std::string(), false,
763 expected2, arraysize(expected2))); 764 expected2, arraysize(expected2)));
764 // The url what you typed match should be around 1400, otherwise the 765 // The url what you typed match should be around 1400, otherwise the
765 // search what you typed match is going to be first. 766 // search what you typed match is going to be first.
766 EXPECT_LE(1400, matches_[0].relevance); 767 EXPECT_LE(1400, matches_[0].relevance);
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 if (test_cases[i].matches[max_matches].url == NULL) 1043 if (test_cases[i].matches[max_matches].url == NULL)
1043 break; 1044 break;
1044 output[max_matches].url = 1045 output[max_matches].url =
1045 url_formatter::FixupURL(test_cases[i].matches[max_matches].url, 1046 url_formatter::FixupURL(test_cases[i].matches[max_matches].url,
1046 std::string()) 1047 std::string())
1047 .spec(); 1048 .spec();
1048 output[max_matches].allowed_to_be_default_match = true; 1049 output[max_matches].allowed_to_be_default_match = true;
1049 } 1050 }
1050 autocomplete_->scoring_params_ = test_cases[i].scoring_params; 1051 autocomplete_->scoring_params_ = test_cases[i].scoring_params;
1051 1052
1052 // Test the control (scoring disabled). 1053 // Test the experiment (scoring enabled). When scoring is disabled, it uses
1053 autocomplete_->scoring_params_.experimental_scoring_enabled = false; 1054 // the default experimental scoring.
1054 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input),
1055 std::string(), false, output, max_matches));
1056 for (int j = 0; j < max_matches; ++j) {
1057 EXPECT_EQ(test_cases[i].matches[j].control_relevance,
1058 matches_[j].relevance);
1059 }
1060
1061 // Test the experiment (scoring enabled).
1062 autocomplete_->scoring_params_.experimental_scoring_enabled = true; 1055 autocomplete_->scoring_params_.experimental_scoring_enabled = true;
1063 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), 1056 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input),
1064 std::string(), false, output, max_matches)); 1057 std::string(), false, output, max_matches));
1065 for (int j = 0; j < max_matches; ++j) { 1058 for (int j = 0; j < max_matches; ++j) {
1066 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, 1059 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance,
1067 matches_[j].relevance); 1060 matches_[j].relevance);
1068 } 1061 }
1069 } 1062 }
1070 } 1063 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698