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

Unified Diff: components/omnibox/autocomplete_result_unittest.cc

Issue 1154063003: removing ShouldHideTopMatch (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Deprecated event proto Created 5 years, 7 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/autocomplete_result_unittest.cc
diff --git a/components/omnibox/autocomplete_result_unittest.cc b/components/omnibox/autocomplete_result_unittest.cc
index 4cc1385fe0a0723abfdbe3c33ea38f2e294d841d..92e5de3de1ff6b00dc605f95f6911bd9b19272c6 100644
--- a/components/omnibox/autocomplete_result_unittest.cc
+++ b/components/omnibox/autocomplete_result_unittest.cc
@@ -646,115 +646,3 @@ TEST_F(AutocompleteResultTest, SortAndCullReorderForDefaultMatch) {
EXPECT_EQ("http://d/", result.match_at(3)->destination_url.spec());
}
}
-
-TEST_F(AutocompleteResultTest, ShouldHideTopMatch) {
- base::FieldTrialList::CreateFieldTrial("InstantExtended",
- "Group1 hide_verbatim:1");
- ACMatches matches;
-
- // Case 1: Top match is a verbatim match.
- PopulateAutocompleteMatchesFromTestData(kVerbatimMatches, 1, &matches);
- AutocompleteResult result;
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_TRUE(result.ShouldHideTopMatch());
- matches.clear();
- result.Reset();
-
- // Case 2: If the verbatim first match is followed by another verbatim match,
- // don't hide the top verbatim match.
- PopulateAutocompleteMatchesFromTestData(kVerbatimMatches,
- arraysize(kVerbatimMatches),
- &matches);
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_FALSE(result.ShouldHideTopMatch());
- matches.clear();
- result.Reset();
-
- // Case 3: Top match is not a verbatim match. Do not hide the top match.
- PopulateAutocompleteMatchesFromTestData(kNonVerbatimMatches, 1, &matches);
- PopulateAutocompleteMatchesFromTestData(kVerbatimMatches,
- arraysize(kVerbatimMatches),
- &matches);
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_FALSE(result.ShouldHideTopMatch());
-}
-
-TEST_F(AutocompleteResultTest, ShouldHideTopMatchAfterCopy) {
- base::FieldTrialList::CreateFieldTrial("InstantExtended",
- "Group1 hide_verbatim:1");
- ACMatches matches;
-
- // Case 1: Top match is a verbatim match followed by only copied matches.
- PopulateAutocompleteMatchesFromTestData(kVerbatimMatches,
- arraysize(kVerbatimMatches),
- &matches);
- for (size_t i = 1; i < arraysize(kVerbatimMatches); ++i)
- matches[i].from_previous = true;
- AutocompleteResult result;
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_TRUE(result.ShouldHideTopMatch());
- result.Reset();
-
- // Case 2: The copied matches are then followed by a non-verbatim match.
- PopulateAutocompleteMatchesFromTestData(kNonVerbatimMatches, 1, &matches);
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_TRUE(result.ShouldHideTopMatch());
- result.Reset();
-
- // Case 3: The copied matches are instead followed by a verbatim match.
- matches.back().from_previous = true;
- PopulateAutocompleteMatchesFromTestData(kVerbatimMatches, 1, &matches);
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_FALSE(result.ShouldHideTopMatch());
-}
-
-TEST_F(AutocompleteResultTest, DoNotHideTopMatch_FieldTrialFlagDisabled) {
- // This test config is identical to ShouldHideTopMatch test ("Case 1") except
- // that the "hide_verbatim" flag is disabled in the field trials.
- base::FieldTrialList::CreateFieldTrial("InstantExtended",
- "Group1 hide_verbatim:0");
- ACMatches matches;
- PopulateAutocompleteMatchesFromTestData(kVerbatimMatches, 1, &matches);
- AutocompleteResult result;
- result.AppendMatches(AutocompleteInput(), matches);
- // Field trial flag "hide_verbatim" is disabled. Do not hide top match.
- EXPECT_FALSE(result.ShouldHideTopMatch());
-}
-
-TEST_F(AutocompleteResultTest, TopMatchIsStandaloneVerbatimMatch) {
- ACMatches matches;
- AutocompleteResult result;
- result.AppendMatches(AutocompleteInput(), matches);
-
- // Case 1: Result set is empty.
- EXPECT_FALSE(result.TopMatchIsStandaloneVerbatimMatch());
-
- // Case 2: Top match is not a verbatim match.
- PopulateAutocompleteMatchesFromTestData(kNonVerbatimMatches, 1, &matches);
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_FALSE(result.TopMatchIsStandaloneVerbatimMatch());
- result.Reset();
- matches.clear();
-
- // Case 3: Top match is a verbatim match.
- PopulateAutocompleteMatchesFromTestData(kVerbatimMatches, 1, &matches);
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_TRUE(result.TopMatchIsStandaloneVerbatimMatch());
- result.Reset();
- matches.clear();
-
- // Case 4: Standalone verbatim match found in AutocompleteResult.
- PopulateAutocompleteMatchesFromTestData(kVerbatimMatches, 1, &matches);
- PopulateAutocompleteMatchesFromTestData(kNonVerbatimMatches, 1, &matches);
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_TRUE(result.TopMatchIsStandaloneVerbatimMatch());
- result.Reset();
- matches.clear();
-
- // Case 5: Multiple verbatim matches found in AutocompleteResult.
- PopulateAutocompleteMatchesFromTestData(kVerbatimMatches,
- arraysize(kVerbatimMatches),
- &matches);
- result.AppendMatches(AutocompleteInput(), matches);
- EXPECT_FALSE(result.ShouldHideTopMatch());
-}
« components/omnibox/autocomplete_result.cc ('K') | « components/omnibox/autocomplete_result.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698