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

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

Issue 2966233002: Omnibox UI Experiments: Strip trivial subdomains (Closed)
Patch Set: address one more comment 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
« no previous file with comments | « components/omnibox/browser/autocomplete_match.cc ('k') | components/url_formatter/url_formatter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ad9aad6584a44e5131a75512611a512b179538fe..f8c27f32128334cc345ce15f3994c4913a859119 100644
--- a/components/omnibox/browser/autocomplete_match_unittest.cc
+++ b/components/omnibox/browser/autocomplete_match_unittest.cc
@@ -112,6 +112,10 @@ TEST(AutocompleteMatchTest, MergeClassifications) {
}
TEST(AutocompleteMatchTest, FormatUrlForSuggestionDisplay) {
+ // This test does not need to verify url_formatter's functionality in-depth,
+ // since url_formatter has its own unit tests. This test is to validate that
+ // flipping feature flags and varying the trim_scheme parameter toggles the
+ // correct behavior within AutocompleteMatch::GetFormatTypes.
struct FormatUrlTestData {
const std::string url;
bool trim_scheme;
@@ -130,7 +134,7 @@ TEST(AutocompleteMatchTest, FormatUrlForSuggestionDisplay) {
};
FormatUrlTestData normal_cases[] = {
- // Sanity check that the trim_scheme parameter works.
+ // Test trim_scheme parameter without any feature flags.
{"http://google.com", true, L"google.com"},
{"https://google.com", true, L"https://google.com"},
{"http://google.com", false, L"http://google.com"},
@@ -138,7 +142,9 @@ TEST(AutocompleteMatchTest, FormatUrlForSuggestionDisplay) {
// Test that paths are preserved in the default case.
{"http://google.com/foobar", true, L"google.com/foobar"},
- };
+
+ // Verify that trivial subdomains are preserved in the normal case.
+ {"http://www.google.com", false, L"http://www.google.com"}};
for (FormatUrlTestData& test_case : normal_cases)
test_case.Validate();
@@ -167,6 +173,15 @@ TEST(AutocompleteMatchTest, FormatUrlForSuggestionDisplay) {
};
for (FormatUrlTestData& test_case : hide_path_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, L"http://google.com"};
+ trim_trivial_subdomains_case.Validate();
}
TEST(AutocompleteMatchTest, SupportsDeletion) {
« no previous file with comments | « components/omnibox/browser/autocomplete_match.cc ('k') | components/url_formatter/url_formatter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698