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

Unified Diff: chrome/browser/omnibox/omnibox_field_trial_unittest.cc

Issue 55413002: Don't demote top match for certain match types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Peter's comments Created 7 years, 1 month 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
« no previous file with comments | « chrome/browser/omnibox/omnibox_field_trial.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/omnibox/omnibox_field_trial_unittest.cc
diff --git a/chrome/browser/omnibox/omnibox_field_trial_unittest.cc b/chrome/browser/omnibox/omnibox_field_trial_unittest.cc
index 82522b6dc6973d3761ab570cf83051e084e18a08..edf222bc06e92ebaf40e1fa26f99d176be69e4fb 100644
--- a/chrome/browser/omnibox/omnibox_field_trial_unittest.cc
+++ b/chrome/browser/omnibox/omnibox_field_trial_unittest.cc
@@ -188,6 +188,34 @@ TEST_F(OmniboxFieldTrialTest, GetDemotionsByTypeWithFallback) {
VerifyDemotion(demotions_by_type, AutocompleteMatchType::HISTORY_URL, 0.25);
}
+TEST_F(OmniboxFieldTrialTest, GetUndemotableTopTypes) {
+ {
+ std::map<std::string, std::string> params;
+ const std::string rule(OmniboxFieldTrial::kUndemotableTopTypeRule);
+ params[rule + ":1:*"] = "1,3";
+ params[rule + ":3:*"] = "5";
+ params[rule + ":*:*"] = "2";
+ ASSERT_TRUE(chrome_variations::AssociateVariationParams(
+ OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params));
+ }
+ base::FieldTrialList::CreateFieldTrial(
+ OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");
+ OmniboxFieldTrial::UndemotableTopMatchTypes undemotable_types;
+ undemotable_types = OmniboxFieldTrial::GetUndemotableTopTypes(
+ AutocompleteInput::NEW_TAB_PAGE);
+ ASSERT_EQ(2u, undemotable_types.size());
+ ASSERT_EQ(1u, undemotable_types.count(AutocompleteMatchType::HISTORY_URL));
+ ASSERT_EQ(1u, undemotable_types.count(AutocompleteMatchType::HISTORY_BODY));
+ undemotable_types = OmniboxFieldTrial::GetUndemotableTopTypes(
+ AutocompleteInput::HOME_PAGE);
+ ASSERT_EQ(1u, undemotable_types.size());
+ ASSERT_EQ(1u, undemotable_types.count(AutocompleteMatchType::NAVSUGGEST));
+ undemotable_types = OmniboxFieldTrial::GetUndemotableTopTypes(
+ AutocompleteInput::BLANK);
+ ASSERT_EQ(1u, undemotable_types.size());
+ ASSERT_EQ(1u, undemotable_types.count(AutocompleteMatchType::HISTORY_TITLE));
+}
+
TEST_F(OmniboxFieldTrialTest, GetValueForRuleInContext) {
// This test starts with Instant Extended off (the default state), then
// enables Instant Extended and tests again on the same rules.
« no previous file with comments | « chrome/browser/omnibox/omnibox_field_trial.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698