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

Unified Diff: chrome/browser/autocomplete/search_provider_unittest.cc

Issue 67693004: Omnibox: Don't Let Users Escape Keyword Mode Accidentally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Peter's latest 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
Index: chrome/browser/autocomplete/search_provider_unittest.cc
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 63270764cda23230ac0e17e58692534840630e2e..bc61ad9b8b96e39c077e1aff42a0019f3d223580 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -61,18 +61,22 @@ class SearchProviderTest : public testing::Test,
public AutocompleteProviderListener {
public:
struct ResultInfo {
- ResultInfo() : result_type(AutocompleteMatchType::NUM_TYPES) {
+ ResultInfo() : result_type(AutocompleteMatchType::NUM_TYPES),
+ allowed_to_be_default_match(false) {
}
ResultInfo(GURL gurl,
AutocompleteMatch::Type result_type,
+ bool allowed_to_be_default_match,
string16 fill_into_edit)
: gurl(gurl),
result_type(result_type),
+ allowed_to_be_default_match(allowed_to_be_default_match),
fill_into_edit(fill_into_edit) {
}
const GURL gurl;
const AutocompleteMatch::Type result_type;
+ const bool allowed_to_be_default_match;
const string16 fill_into_edit;
};
@@ -266,9 +270,8 @@ void SearchProviderTest::RunTest(TestData* cases,
EXPECT_EQ(cases[i].output[j].fill_into_edit,
matches[j].fill_into_edit) <<
diagnostic_details;
msw 2013/11/20 21:05:03 nit: this fits on the line above.
Mark P 2013/11/21 21:30:22 Done.
- // All callers that use this helper function at the moment produce
- // matches that are always allowed to be the default match.
- EXPECT_TRUE(matches[j].allowed_to_be_default_match);
+ EXPECT_EQ(cases[i].output[j].allowed_to_be_default_match,
+ matches[j].allowed_to_be_default_match) << diagnostic_details;
}
}
}
@@ -833,7 +836,7 @@ TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) {
EXPECT_GT(result.match_at(1).relevance, result.match_at(2).relevance);
EXPECT_TRUE(result.match_at(0).allowed_to_be_default_match);
EXPECT_TRUE(result.match_at(1).allowed_to_be_default_match);
- EXPECT_TRUE(result.match_at(2).allowed_to_be_default_match);
+ EXPECT_FALSE(result.match_at(2).allowed_to_be_default_match);
// The two keyword results should come with the keyword we expect.
EXPECT_EQ(ASCIIToUTF16("k"), result.match_at(0).keyword);
@@ -858,9 +861,11 @@ TEST_F(SearchProviderTest, KeywordVerbatim) {
{ ASCIIToUTF16("k foo"), 2,
{ ResultInfo(GURL("http://keyword/foo"),
AutocompleteMatchType::SEARCH_OTHER_ENGINE,
+ true,
ASCIIToUTF16("k foo")),
ResultInfo(GURL("http://defaultturl/k%20foo"),
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ false,
ASCIIToUTF16("k foo") ) } },
// Make sure extra whitespace after the keyword doesn't change the
@@ -868,9 +873,11 @@ TEST_F(SearchProviderTest, KeywordVerbatim) {
{ ASCIIToUTF16("k foo"), 2,
{ ResultInfo(GURL("http://keyword/foo"),
AutocompleteMatchType::SEARCH_OTHER_ENGINE,
+ true,
ASCIIToUTF16("k foo")),
ResultInfo(GURL("http://defaultturl/k%20%20%20foo"),
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ false,
ASCIIToUTF16("k foo")) } },
// Leading whitespace should be stripped before SearchProvider gets the
// input; hence there are no tests here about how it handles those inputs.
@@ -880,9 +887,11 @@ TEST_F(SearchProviderTest, KeywordVerbatim) {
{ ASCIIToUTF16("k foo bar"), 2,
{ ResultInfo(GURL("http://keyword/foo%20%20bar"),
AutocompleteMatchType::SEARCH_OTHER_ENGINE,
+ true,
ASCIIToUTF16("k foo bar")),
ResultInfo(GURL("http://defaultturl/k%20%20foo%20%20bar"),
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ false,
ASCIIToUTF16("k foo bar")) } },
// Note in the above test case we don't test trailing whitespace because
// SearchProvider still doesn't handle this well. See related bugs:
@@ -893,23 +902,29 @@ TEST_F(SearchProviderTest, KeywordVerbatim) {
{ ASCIIToUTF16("www.k foo"), 2,
{ ResultInfo(GURL("http://keyword/foo"),
AutocompleteMatchType::SEARCH_OTHER_ENGINE,
+ true,
ASCIIToUTF16("k foo")),
ResultInfo(GURL("http://defaultturl/www.k%20foo"),
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ false,
ASCIIToUTF16("www.k foo")) } },
{ ASCIIToUTF16("http://k foo"), 2,
{ ResultInfo(GURL("http://keyword/foo"),
AutocompleteMatchType::SEARCH_OTHER_ENGINE,
+ true,
ASCIIToUTF16("k foo")),
ResultInfo(GURL("http://defaultturl/http%3A//k%20foo"),
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ false,
ASCIIToUTF16("http://k foo")) } },
{ ASCIIToUTF16("http://www.k foo"), 2,
{ ResultInfo(GURL("http://keyword/foo"),
AutocompleteMatchType::SEARCH_OTHER_ENGINE,
+ true,
ASCIIToUTF16("k foo")),
ResultInfo(GURL("http://defaultturl/http%3A//www.k%20foo"),
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ false,
ASCIIToUTF16("http://www.k foo")) } },
// A keyword with no remaining input shouldn't get a keyword
@@ -917,10 +932,12 @@ TEST_F(SearchProviderTest, KeywordVerbatim) {
{ ASCIIToUTF16("k"), 1,
{ ResultInfo(GURL("http://defaultturl/k"),
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ true,
ASCIIToUTF16("k")) } },
{ ASCIIToUTF16("k "), 1,
{ ResultInfo(GURL("http://defaultturl/k%20"),
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ true,
ASCIIToUTF16("k ")) } }
// The fact that verbatim queries to keyword are handled by KeywordProvider
@@ -958,9 +975,11 @@ TEST_F(SearchProviderTest, CommandLineOverrides) {
{ ASCIIToUTF16("k a"), 2,
{ ResultInfo(GURL("http://keyword/a"),
AutocompleteMatchType::SEARCH_OTHER_ENGINE,
+ true,
ASCIIToUTF16("k a")),
ResultInfo(GURL("http://www.bar.com/k%20a?a=b"),
AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED,
+ false,
ASCIIToUTF16("k a")) } },
};
@@ -1604,10 +1623,15 @@ TEST_F(SearchProviderTest, DefaultFetcherSuggestRelevanceWithReorder) {
const std::string description = "for input with json=" + cases[i].json;
const ACMatches& matches = provider_->matches();
- // The top match must inline and score as highly as calculated verbatim.
ASSERT_FALSE(matches.empty());
+ // Find the first match that's allowed to be the default match and check
msw 2013/11/20 21:05:03 I know you only added this code in two places, but
Mark P 2013/11/21 21:30:22 Okay, done.
+ // its inline_autocompletion.
+ ACMatches::const_iterator it = matches.begin();
+ while ((it != matches.end()) && !it->allowed_to_be_default_match)
+ ++it;
+ ASSERT_NE(matches.end(), it);
EXPECT_EQ(ASCIIToUTF16(cases[i].inline_autocompletion),
- matches[0].inline_autocompletion) << description;
+ it->inline_autocompletion) << description;
ASSERT_LE(matches.size(), ARRAYSIZE_UNSAFE(cases[i].matches));
size_t j = 0;
@@ -1650,7 +1674,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
// the default provider verbatim.
{ "[\"a\",[\"b\", \"c\"],[],[],{\"google:suggestrelevance\":[1, 2]}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "c", true, false },
{ "b", true, false },
kEmptyMatch, kEmptyMatch },
@@ -1658,12 +1682,9 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
// Again, check that relevance scores reorder matches, just this
// time with navigation matches. This also checks that with
// suggested relevance scores we allow multiple navsuggest results.
- // It's odd that navsuggest results that come from a keyword
- // provider are marked as not a keyword result. I think this
- // comes from them not going to a keyword search engine).
- // TODO(mpearson): Investigate the implications (if any) of
- // tagging these results appropriately. If so, do it because it
- // makes more sense.
+ // Note that navsuggest results that come from a keyword provider
+ // are marked as not a keyword result. (They don't go to a
+ // keyword search engine.)
{ "[\"a\",[\"http://b.com\", \"http://c.com\", \"d\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
"\"google:suggestrelevance\":[1301, 1302, 1303]}]",
@@ -1671,7 +1692,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ "d", true, false },
{ "c.com", false, false },
{ "b.com", false, false },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
std::string() },
@@ -1681,7 +1702,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"]}]",
{ { "a", true, true },
{ "b.com", false, false },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
@@ -1691,27 +1712,27 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:suggestrelevance\":[9998]}]",
{ { "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":9998,"
"\"google:suggestrelevance\":[9999]}]",
{ { "a1", true, true },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
"1" },
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9999]}]",
{ { "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
"1" },
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":-1,"
"\"google:suggestrelevance\":[9999]}]",
{ { "a1", true, true },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
"1" },
{ "[\"a\",[\"http://a.com\"],[],[],"
@@ -1719,8 +1740,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":9999,"
"\"google:suggestrelevance\":[9998]}]",
{ { "a", true, true },
- { "a.com", false, true },
- { "k a", false, true },
+ { "a.com", false, false },
msw 2013/11/20 21:05:03 This is the only behavior change that seems questi
Mark P 2013/11/21 21:30:22 Acknowledged. Filed https://code.google.com/p/chr
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
@@ -1730,7 +1751,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ { "a1", true, true },
{ "a", true, true },
{ "a2", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"1" },
@@ -1739,14 +1760,14 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999]}]",
{ { "a", true, true },
{ "b", true, false },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999],"
"\"google:verbatimrelevance\":0}]",
{ { "a", true, true },
{ "b", true, false },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://b.com\"],[],[],"
@@ -1754,7 +1775,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:suggestrelevance\":[9999]}]",
{ { "a", true, true },
{ "b.com", false, false },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://b.com\"],[],[],"
@@ -1763,7 +1784,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":0}]",
{ { "a", true, true },
{ "b.com", false, false },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
@@ -1774,13 +1795,13 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0}]",
{ { "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":1}]",
{ { "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
// Continuing the same category of tests, but make sure we keep the
@@ -1789,14 +1810,14 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[1],"
"\"google:verbatimrelevance\":0}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "a1", true, true },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 2],"
"\"google:verbatimrelevance\":0}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "a2", true, true },
{ "a1", true, true },
kEmptyMatch, kEmptyMatch },
@@ -1804,7 +1825,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 3],"
"\"google:verbatimrelevance\":2}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "a2", true, true },
{ "a1", true, true },
kEmptyMatch, kEmptyMatch },
@@ -1814,7 +1835,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ "[\"a\",[\"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"],[],[],"
"{\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "h", true, false },
{ "g", true, false },
{ "f", true, false },
@@ -1829,7 +1850,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"NAVIGATION\"],"
"\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "h.com", false, false },
{ "g.com", false, false },
{ "f.com", false, false },
@@ -1843,13 +1864,13 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ { "a", true, true },
{ "a1", true, true },
{ "a2", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]",
{ { "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
// In this case, ignoring the suggested relevance scores means we keep
@@ -1858,16 +1879,16 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
"\"google:suggestrelevance\":[1]}]",
{ { "a", true, true },
- { "a1.com", false, true },
- { "k a", false, true },
+ { "a1.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://a1.com\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\"],"
"\"google:suggestrelevance\":[9999, 1]}]",
{ { "a", true, true },
- { "a1.com", false, true },
- { "k a", false, true },
+ { "a1.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
@@ -1877,7 +1898,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ { "a2", true, true },
{ "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"2" },
{ "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
@@ -1886,7 +1907,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
{ { "a2", true, true },
{ "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"2" },
@@ -1895,12 +1916,12 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
// (except when suggested relevances are ignored).
{ "[\"a\",[],[],[],{\"google:verbatimrelevance\":1}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
@@ -1914,9 +1935,9 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9998, 9999]}]",
{ { "a", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
- { "k a", false, true },
+ { "a2.com", false, false },
+ { "a1.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
@@ -1924,17 +1945,17 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9999, 9998]}]",
{ { "a", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
- { "k a", false, true },
+ { "a1.com", false, false },
+ { "a2.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"https://a/\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\"],"
"\"google:suggestrelevance\":[9999]}]",
- { { "a", true, true },
- { "https://a", false, true },
- { "k a", false, true },
+ { { "a", true, true },
+ { "https://a", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
// Check when navsuggest scores more than verbatim and there is query
@@ -1944,10 +1965,10 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9998, 9999, 1300]}]",
{ { "a", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
+ { "a2.com", false, false },
+ { "a1.com", false, false },
{ "a3", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
@@ -1955,10 +1976,10 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9999, 9998, 1300]}]",
{ { "a", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
+ { "a1.com", false, false },
+ { "a2.com", false, false },
{ "a3", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
std::string() },
// Check when navsuggest scores more than a query suggestion. There is
@@ -1968,10 +1989,10 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9998, 9999, 9997]}]",
{ { "a3", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
+ { "a2.com", false, false },
+ { "a1.com", false, false },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
"3" },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
@@ -1979,10 +2000,10 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9999, 9998, 9997]}]",
{ { "a3", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
+ { "a1.com", false, false },
+ { "a2.com", false, false },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
"3" },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
@@ -1990,9 +2011,9 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9998, 9999, 9997]}]",
{ { "a3", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
- { "k a", false, true },
+ { "a2.com", false, false },
+ { "a1.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"3" },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
@@ -2000,9 +2021,9 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9999, 9998, 9997]}]",
{ { "a3", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
- { "k a", false, true },
+ { "a1.com", false, false },
+ { "a2.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"3" },
// Check when there is neither verbatim nor a query suggestion that,
@@ -2017,8 +2038,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9998, 9999]}]",
{ { "a", true, true },
- { "a2.com", false, true },
- { "k a", false, true },
+ { "a2.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
@@ -2026,8 +2047,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9999, 9998]}]",
{ { "a", true, true },
- { "a1.com", false, true },
- { "k a", false, true },
+ { "a1.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
// More checks that everything works when it's not necessary to demote.
@@ -2036,10 +2057,10 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9997, 9998, 9999]}]",
{ { "a3", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
+ { "a2.com", false, false },
+ { "a1.com", false, false },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
"3" },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
@@ -2047,10 +2068,10 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9998, 9997, 9999]}]",
{ { "a3", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
+ { "a1.com", false, false },
+ { "a2.com", false, false },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
"3" },
};
@@ -2127,7 +2148,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
// the default provider verbatim.
{ "[\"a\",[\"b\", \"c\"],[],[],{\"google:suggestrelevance\":[1, 2]}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "c", true, false },
{ "b", true, false },
kEmptyMatch, kEmptyMatch },
@@ -2135,12 +2156,9 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
// Again, check that relevance scores reorder matches, just this
// time with navigation matches. This also checks that with
// suggested relevance scores we allow multiple navsuggest results.
- // It's odd that navsuggest results that come from a keyword
- // provider are marked as not a keyword result. I think this
- // comes from them not going to a keyword search engine.
- // TODO(mpearson): Investigate the implications (if any) of
- // tagging these results appropriately. If so, do it because it
- // makes more sense.
+ // Note that navsuggest results that come from a keyword provider
+ // are marked as not a keyword result. (They don't go to a
+ // keyword search engine.)
{ "[\"a\",[\"http://b.com\", \"http://c.com\", \"d\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
"\"google:suggestrelevance\":[1301, 1302, 1303]}]",
@@ -2148,7 +2166,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
{ "d", true, false },
{ "c.com", false, false },
{ "b.com", false, false },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
std::string() },
@@ -2158,7 +2176,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"]}]",
{ { "a", true, true },
{ "b.com", false, false },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
@@ -2168,27 +2186,27 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"\"google:suggestrelevance\":[9998]}]",
{ { "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":9998,"
"\"google:suggestrelevance\":[9999]}]",
{ { "a1", true, true },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
"1" },
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9999]}]",
{ { "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
"1" },
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":-1,"
"\"google:suggestrelevance\":[9999]}]",
{ { "a1", true, true },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
"1" },
{ "[\"a\",[\"http://a.com\"],[],[],"
@@ -2196,8 +2214,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"\"google:verbatimrelevance\":9999,"
"\"google:suggestrelevance\":[9998]}]",
{ { "a", true, true },
- { "a.com", false, true },
- { "k a", false, true },
+ { "a.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
@@ -2207,7 +2225,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
{ { "a1", true, true },
{ "a", true, true },
{ "a2", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"1" },
@@ -2216,21 +2234,24 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
{ "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999]}]",
{ { "b", true, false },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
- { "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999],"
- "\"google:verbatimrelevance\":0}]",
- { { "b", true, false },
- { "k a", false, true },
- kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
- std::string() },
{ "[\"a\",[\"http://b.com\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\"],"
"\"google:suggestrelevance\":[9999]}]",
{ { "b.com", false, false },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
+ kEmptyMatch, kEmptyMatch, kEmptyMatch },
+ std::string() },
+ // On the other hand, if there is no inlineable match, restore
msw 2013/11/20 21:05:03 Nice, I think this is a good behavior change!
Mark P 2013/11/21 21:30:22 Acknowledged. (Thanks!)
+ // the keyword verbatim score.
+ { "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999],"
+ "\"google:verbatimrelevance\":0}]",
+ { { "b", true, false },
+ { "a", true, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://b.com\"],[],[],"
@@ -2238,8 +2259,9 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"\"google:suggestrelevance\":[9999],"
"\"google:verbatimrelevance\":0}]",
{ { "b.com", false, false },
- { "k a", false, true },
- kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
+ { "a", true, true },
+ { "k a", false, false },
+ kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
// The top result does not have to score as highly as calculated
@@ -2247,43 +2269,43 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
// this provider.
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0}]",
{ { "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
"1" },
{ "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":1}]",
{ { "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "a", true, true },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
"1" },
{ "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[1],"
"\"google:verbatimrelevance\":0}]",
- { { "k a", false, true },
+ { { "k a", false, false },
{ "a1", true, true },
kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
- std::string() },
+ "1" },
{ "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 2],"
"\"google:verbatimrelevance\":0}]",
{
- { "k a", false, true },
+ { "k a", false, false },
{ "a2", true, true },
{ "a1", true, true },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
- std::string() },
+ "2" },
{ "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 3],"
"\"google:verbatimrelevance\":2}]",
- { { "k a", false, true },
+ { { "k a", false, false },
{ "a2", true, true },
{ "a", true, true },
{ "a1", true, true },
kEmptyMatch, kEmptyMatch },
- std::string() },
+ "2" },
// Ensure that all suggestions are considered, regardless of order.
{ "[\"a\",[\"b\", \"c\", \"d\", \"e\", \"f\", \"g\", \"h\"],[],[],"
"{\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "h", true, false },
{ "g", true, false },
{ "f", true, false },
@@ -2298,7 +2320,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"\"NAVIGATION\"],"
"\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
{ "h.com", false, false },
{ "g.com", false, false },
{ "f.com", false, false },
@@ -2312,13 +2334,13 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
{ { "a", true, true },
{ "a1", true, true },
{ "a2", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]",
{ { "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
// In this case, ignoring the suggested relevance scores means we keep
@@ -2327,16 +2349,16 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
"\"google:suggestrelevance\":[1]}]",
{ { "a", true, true },
- { "a1.com", false, true },
- { "k a", false, true },
+ { "a1.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://a1.com\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\"],"
"\"google:suggestrelevance\":[9999, 1]}]",
{ { "a", true, true },
- { "a1.com", false, true },
- { "k a", false, true },
+ { "a1.com", false, false },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
@@ -2346,7 +2368,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
{ { "a2", true, true },
{ "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"2" },
{ "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
@@ -2355,7 +2377,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
{ { "a2", true, true },
{ "a", true, true },
{ "a1", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"2" },
@@ -2363,47 +2385,45 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
// TODO(mpearson): Ensure the value of verbatimrelevance is respected
// (except when suggested relevances are ignored).
{ "[\"a\",[],[],[],{\"google:verbatimrelevance\":1}]",
- { { "k a", false, true },
+ { { "k a", false, false },
{ "a", true, true },
kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]",
{ { "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
- // Check that navsuggestions will be demoted below queries.
- // (Navsuggestions are not allowed to appear first.) In the process,
- // make sure the navsuggestions still remain in the same order.
- // First, check the situation where navsuggest scores more than verbatim
- // and there are no query suggestions.
+ // In reorder mode, navsuggestions will not need to be demoted (because
+ // they are marked as not allowed to be default match and will be
+ // reordered as necessary).
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9998, 9999]}]",
- { { "a", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
- { "k a", false, true },
+ { { "a2.com", false, false },
+ { "a1.com", false, false },
+ { "a", true, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9999, 9998]}]",
- { { "a", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
- { "k a", false, true },
+ { { "a1.com", false, false },
+ { "a2.com", false, false },
+ { "a", true, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"https://a/\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\"],"
"\"google:suggestrelevance\":[9999]}]",
- { { "a", true, true },
- { "https://a", false, true },
- { "k a", false, true },
+ { { "https://a", false, false },
+ { "a", true, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch, kEmptyMatch },
std::string() },
// Check when navsuggest scores more than verbatim and there is query
@@ -2412,22 +2432,22 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9998, 9999, 1300]}]",
- { { "a", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
+ { { "a2.com", false, false },
+ { "a1.com", false, false },
+ { "a", true, true },
{ "a3", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9999, 9998, 1300]}]",
- { { "a", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
+ { { "a1.com", false, false },
+ { "a2.com", false, false },
+ { "a", true, true },
{ "a3", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
std::string() },
// Check when navsuggest scores more than a query suggestion. There is
@@ -2436,68 +2456,66 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9998, 9999, 9997]}]",
- { { "a3", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
+ { { "a2.com", false, false },
+ { "a1.com", false, false },
+ { "a3", true, true },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
"3" },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9999, 9998, 9997]}]",
- { { "a3", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
+ { { "a1.com", false, false },
+ { "a2.com", false, false },
+ { "a3", true, true },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
"3" },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
"\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9998, 9999, 9997]}]",
- { { "a3", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
- { "k a", false, true },
+ { { "a2.com", false, false },
+ { "a1.com", false, false },
+ { "a3", true, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"3" },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
"\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9999, 9998, 9997]}]",
- { { "a3", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
- { "k a", false, true },
+ { { "a1.com", false, false },
+ { "a2.com", false, false },
+ { "a3", true, true },
+ { "k a", false, false },
kEmptyMatch, kEmptyMatch },
"3" },
// Check when there is neither verbatim nor a query suggestion that,
// because we can't demote navsuggestions below a query suggestion,
- // we abandon suggested relevance scores entirely. One consequence is
- // that this means we restore the keyword verbatim match. Note
- // that in this case of abandoning suggested relevance scores, we still
- // keep the navsuggestions in the same order, but we revert to only allowing
- // one navigation to appear because the scores are completely local.
+ // we restore the keyword verbatim score.
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
"\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9998, 9999]}]",
- { { "a", true, true },
- { "a2.com", false, true },
- { "k a", false, true },
- kEmptyMatch, kEmptyMatch, kEmptyMatch },
+ { { "a2.com", false, false },
+ { "a1.com", false, false },
+ { "a", true, true },
+ { "k a", false, false },
+ kEmptyMatch, kEmptyMatch },
std::string() },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
"{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
"\"google:verbatimrelevance\":0,"
"\"google:suggestrelevance\":[9999, 9998]}]",
- { { "a", true, true },
- { "a1.com", false, true },
- { "k a", false, true },
- kEmptyMatch, kEmptyMatch, kEmptyMatch },
+ { { "a1.com", false, false },
+ { "a2.com", false, false },
+ { "a", true, true },
+ { "k a", false, false },
+ kEmptyMatch, kEmptyMatch },
std::string() },
// More checks that everything works when it's not necessary to demote.
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
@@ -2505,10 +2523,10 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9997, 9998, 9999]}]",
{ { "a3", true, true },
- { "a2.com", false, true },
- { "a1.com", false, true },
+ { "a2.com", false, false },
+ { "a1.com", false, false },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
"3" },
{ "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
@@ -2516,10 +2534,10 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
"\"google:verbatimrelevance\":9990,"
"\"google:suggestrelevance\":[9998, 9997, 9999]}]",
{ { "a3", true, true },
- { "a1.com", false, true },
- { "a2.com", false, true },
+ { "a1.com", false, false },
+ { "a2.com", false, false },
{ "a", true, true },
- { "k a", false, true },
+ { "k a", false, false },
kEmptyMatch },
"3" },
};
@@ -2557,10 +2575,15 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
const std::string description = "for input with json=" + cases[i].json;
const ACMatches& matches = provider_->matches();
- // The top match must inline and score as highly as calculated verbatim.
ASSERT_FALSE(matches.empty());
+ // Find the first match that's allowed to be the default match and check
+ // its inline_autocompletion.
+ ACMatches::const_iterator it = matches.begin();
+ while ((it != matches.end()) && !it->allowed_to_be_default_match)
+ ++it;
+ ASSERT_NE(matches.end(), it);
EXPECT_EQ(ASCIIToUTF16(cases[i].inline_autocompletion),
- matches[0].inline_autocompletion) << description;
+ it->inline_autocompletion) << description;
ASSERT_LE(matches.size(), ARRAYSIZE_UNSAFE(cases[i].matches));
size_t j = 0;

Powered by Google App Engine
This is Rietveld 408576698