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

Unified Diff: components/omnibox/browser/autocomplete_match_unittest.cc

Issue 2966233002: Omnibox UI Experiments: Strip trivial subdomains (Closed)
Patch Set: make cast explicit for windows Created 3 years, 5 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: components/omnibox/browser/autocomplete_match_unittest.cc
diff --git a/components/omnibox/browser/autocomplete_match_unittest.cc b/components/omnibox/browser/autocomplete_match_unittest.cc
index e6627425c16662723f27faad514eab087dfd1f2a..51cb3daf8a84118f18196758b025123af8bf60c5 100644
--- a/components/omnibox/browser/autocomplete_match_unittest.cc
+++ b/components/omnibox/browser/autocomplete_match_unittest.cc
@@ -129,17 +129,19 @@ TEST(AutocompleteMatchTest, FormatUrlForSuggestionDisplay) {
};
};
- // Sanity check that the trim_strings parameter works.
FormatUrlTestData normal_cases[] = {
+ // Test trim_scheme parameter without any feature flags.
{"http://google.com", true, "google.com"},
{"https://google.com", true, "https://google.com"},
{"http://google.com", false, "http://google.com"},
{"https://google.com", false, "https://google.com"},
- };
+
+ // Verify that trivial subdomains are preserved in the normal case.
+ {"http://www.google.com", false, "http://www.google.com"}};
for (FormatUrlTestData& test_case : normal_cases)
test_case.Validate();
- // Test the hide-scheme feature flag.
+ // Test the hide-scheme feature flag with the trim_scheme paramater.
std::unique_ptr<base::test::ScopedFeatureList> feature_list(
new base::test::ScopedFeatureList);
feature_list->InitAndEnableFeature(
@@ -153,6 +155,15 @@ TEST(AutocompleteMatchTest, FormatUrlForSuggestionDisplay) {
};
for (FormatUrlTestData& test_case : omit_scheme_cases)
test_case.Validate();
+
+ // Test the trim trivial subdomains feature flag.
+ feature_list.reset(new base::test::ScopedFeatureList);
+ feature_list->InitAndEnableFeature(
+ omnibox::kUIExperimentHideSuggestionUrlTrivialSubdomains);
+
+ FormatUrlTestData trim_trivial_subdomains_case = {"http://www.m.google.com",
+ false, "http://google.com"};
+ trim_trivial_subdomains_case.Validate();
}
TEST(AutocompleteMatchTest, SupportsDeletion) {

Powered by Google App Engine
This is Rietveld 408576698