| 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 cc5fa939dc7c6a782664cb85fc006dc9663ce107..b322017c4c2e6e6c7c1f37a0ba95bd96d8d93d4f 100644
|
| --- a/chrome/browser/autocomplete/search_provider_unittest.cc
|
| +++ b/chrome/browser/autocomplete/search_provider_unittest.cc
|
| @@ -22,7 +22,6 @@
|
| #include "chrome/browser/history/history_service.h"
|
| #include "chrome/browser/history/history_service_factory.h"
|
| #include "chrome/browser/omnibox/omnibox_field_trial.h"
|
| -#include "chrome/browser/search/search.h"
|
| #include "chrome/browser/search_engines/template_url.h"
|
| #include "chrome/browser/search_engines/template_url_service.h"
|
| #include "chrome/browser/search_engines/template_url_service_factory.h"
|
| @@ -939,138 +938,163 @@ TEST_F(SearchProviderTest, DefaultFetcherSuggestRelevance) {
|
| const DefaultFetcherMatch kEmptyMatch = { kNotApplicable, false };
|
| struct {
|
| const std::string json;
|
| - const DefaultFetcherMatch matches[4];
|
| + const DefaultFetcherMatch matches[6];
|
| const std::string inline_autocompletion;
|
| } cases[] = {
|
| // Ensure that suggestrelevance scores reorder matches.
|
| { "[\"a\",[\"b\", \"c\"],[],[],{\"google:suggestrelevance\":[1, 2]}]",
|
| - { { "a", true }, { "c", false }, { "b", false }, kEmptyMatch },
|
| + { { "a", true }, { "c", false }, { "b", false }, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\", \"http://c.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1, 2]}]",
|
| - { { "a", true }, { "c.com", false }, { "b.com", false }, kEmptyMatch },
|
| + { { "a", true }, { "c.com", false }, { "b.com", false }, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Without suggested relevance scores, we should only allow one
|
| // navsuggest result to be be displayed.
|
| { "[\"a\",[\"http://b.com\", \"http://c.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"]}]",
|
| - { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that verbatimrelevance scores reorder or suppress verbatim.
|
| // Negative values will have no effect; the calculated value will be used.
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":9999,"
|
| "\"google:suggestrelevance\":[9998]}]",
|
| - { { "a", true}, { "a1", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true}, { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":9998,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":-1,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:verbatimrelevance\":9999,"
|
| "\"google:suggestrelevance\":[9998]}]",
|
| - { { "a", true }, { "a.com", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:verbatimrelevance\":9998,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a.com", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a.com", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| ".com" },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:verbatimrelevance\":0,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| ".com" },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:verbatimrelevance\":-1,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a.com", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a.com", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| ".com" },
|
|
|
| // Ensure that both types of relevance scores reorder matches together.
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[9999, 9997],"
|
| "\"google:verbatimrelevance\":9998}]",
|
| - { { "a1", true }, { "a", true }, { "a2", true }, kEmptyMatch },
|
| + { { "a1", true }, { "a", true }, { "a2", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
|
|
| // Ensure that only inlinable matches may be ranked as the highest result.
|
| // Ignore all suggested relevance scores if this constraint is violated.
|
| { "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999]}]",
|
| - { { "a", true }, { "b", false }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "b", false }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, { "b", false }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "b", false }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[9999],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"https://a/\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "https://a", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "https://a", true }, { "a", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that the top result is ranked as highly as calculated verbatim.
|
| // Ignore the suggested verbatim relevance if this constraint is violated.
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":1}]",
|
| - { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[1],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 2],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, { "a2", true }, { "a1", true }, kEmptyMatch },
|
| + { { "a", true }, { "a2", true }, { "a1", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 3],"
|
| "\"google:verbatimrelevance\":2}]",
|
| - { { "a", true }, { "a2", true }, { "a1", true }, kEmptyMatch },
|
| + { { "a", true }, { "a2", true }, { "a1", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, { "a.com", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1, 2],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, { "a2.com", true }, { "a1.com", true }, kEmptyMatch },
|
| + { { "a", true }, { "a2.com", true }, { "a1.com", true }, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // 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 }, { "h", false }, { "g", false }, { "f", false } },
|
| + { { "a", true }, { "h", false }, { "g", false }, { "f", false },
|
| + {"e", false }, {"d", false } },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\", \"http://c.com\", \"http://d.com\","
|
| "\"http://e.com\", \"http://f.com\", \"http://g.com\","
|
| @@ -1081,45 +1105,53 @@ TEST_F(SearchProviderTest, DefaultFetcherSuggestRelevance) {
|
| "\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
|
| { { "a", true }, { "h.com", false }, { "g.com", false },
|
| - { "f.com", false } },
|
| + { "f.com", false }, {"e.com", false }, {"d.com", false } },
|
| std::string() },
|
|
|
| // Ensure that incorrectly sized suggestion relevance lists are ignored.
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1]}]",
|
| - { { "a", true }, { "a1", true }, { "a2", true }, kEmptyMatch },
|
| + { { "a", true }, { "a1", true }, { "a2", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]",
|
| - { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1]}]",
|
| - { { "a", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a1.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[9999, 1]}]",
|
| - { { "a", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that all 'verbatim' results are merged with their maximum score.
|
| { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
|
| "{\"google:suggestrelevance\":[9998, 9997, 9999]}]",
|
| - { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch },
|
| + { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "2" },
|
| { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
|
| "{\"google:suggestrelevance\":[9998, 9997, 9999],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch },
|
| + { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "2" },
|
|
|
| // Ensure that verbatim is always generated without other suggestions.
|
| // TODO(msw): Ensure verbatimrelevance is respected (except suppression).
|
| { "[\"a\",[],[],[],{\"google:verbatimrelevance\":1}]",
|
| - { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| };
|
|
|
| @@ -1170,133 +1202,157 @@ TEST_F(SearchProviderTest, DefaultFetcherSuggestRelevanceWithReorder) {
|
| const DefaultFetcherMatch kEmptyMatch = { kNotApplicable, false };
|
| struct {
|
| const std::string json;
|
| - const DefaultFetcherMatch matches[4];
|
| + const DefaultFetcherMatch matches[6];
|
| const std::string inline_autocompletion;
|
| } cases[] = {
|
| // Ensure that suggestrelevance scores reorder matches.
|
| { "[\"a\",[\"b\", \"c\"],[],[],{\"google:suggestrelevance\":[1, 2]}]",
|
| - { { "a", true }, { "c", false }, { "b", false }, kEmptyMatch },
|
| + { { "a", true }, { "c", false }, { "b", false }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\", \"http://c.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1, 2]}]",
|
| - { { "a", true }, { "c.com", false }, { "b.com", false }, kEmptyMatch },
|
| + { { "a", true }, { "c.com", false }, { "b.com", false }, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Without suggested relevance scores, we should only allow one
|
| // navsuggest result to be be displayed.
|
| { "[\"a\",[\"http://b.com\", \"http://c.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"]}]",
|
| - { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that verbatimrelevance scores reorder or suppress verbatim.
|
| // Negative values will have no effect; the calculated value will be used.
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":9999,"
|
| "\"google:suggestrelevance\":[9998]}]",
|
| - { { "a", true}, { "a1", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true}, { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":9998,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":-1,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:verbatimrelevance\":9999,"
|
| "\"google:suggestrelevance\":[9998]}]",
|
| - { { "a", true }, { "a.com", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:verbatimrelevance\":9998,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a.com", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a.com", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| ".com" },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:verbatimrelevance\":0,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| ".com" },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:verbatimrelevance\":-1,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "a.com", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a.com", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| ".com" },
|
|
|
| // Ensure that both types of relevance scores reorder matches together.
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[9999, 9997],"
|
| "\"google:verbatimrelevance\":9998}]",
|
| - { { "a1", true }, { "a", true }, { "a2", true }, kEmptyMatch },
|
| + { { "a1", true }, { "a", true }, { "a2", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
|
|
| // Allow non-inlineable matches to be the highest-scoring match but,
|
| // if the result set lacks a single inlineable result, abandon suggested
|
| // relevance scores entirely.
|
| { "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999]}]",
|
| - { { "b", false }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "b", false }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, { "b", false }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "b", false }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| - { { "b.com", false }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "b.com", false }, { "a", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[9999],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "b.com", false }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Allow low-scoring matches.
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0}]",
|
| - { { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":1}]",
|
| - { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[1],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 2],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a2", true }, { "a1", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a2", true }, { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "2" },
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 3],"
|
| "\"google:verbatimrelevance\":2}]",
|
| - { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch },
|
| + { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "2" },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| ".com" },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1, 2],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a2.com", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a2.com", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| "2.com" },
|
|
|
| // 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 }, { "h", false }, { "g", false }, { "f", false } },
|
| + { { "a", true }, { "h", false }, { "g", false }, { "f", false },
|
| + { "e", false }, { "d", false } },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\", \"http://c.com\", \"http://d.com\","
|
| "\"http://e.com\", \"http://f.com\", \"http://g.com\","
|
| @@ -1307,45 +1363,53 @@ TEST_F(SearchProviderTest, DefaultFetcherSuggestRelevanceWithReorder) {
|
| "\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
|
| { { "a", true }, { "h.com", false }, { "g.com", false },
|
| - { "f.com", false } },
|
| + { "f.com", false }, { "e.com", false }, { "d.com", false } },
|
| std::string() },
|
|
|
| // Ensure that incorrectly sized suggestion relevance lists are ignored.
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1]}]",
|
| - { { "a", true }, { "a1", true }, { "a2", true }, kEmptyMatch },
|
| + { { "a", true }, { "a1", true }, { "a2", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]",
|
| - { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[1]}]",
|
| - { { "a", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a1.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| "\"google:suggestrelevance\":[9999, 1]}]",
|
| - { { "a", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, { "a1.com", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that all 'verbatim' results are merged with their maximum score.
|
| { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
|
| "{\"google:suggestrelevance\":[9998, 9997, 9999]}]",
|
| - { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch },
|
| + { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "2" },
|
| { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
|
| "{\"google:suggestrelevance\":[9998, 9997, 9999],"
|
| "\"google:verbatimrelevance\":0}]",
|
| - { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch },
|
| + { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| "2" },
|
|
|
| // Ensure that verbatim is always generated without other suggestions.
|
| // TODO(msw): Ensure verbatimrelevance is respected (except suppression).
|
| { "[\"a\",[],[],[],{\"google:verbatimrelevance\":1}]",
|
| - { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]",
|
| - { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
|
| + kEmptyMatch },
|
| std::string() },
|
| };
|
|
|
| @@ -1407,7 +1471,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| const KeywordFetcherMatch kEmptyMatch = { kNotApplicable, false, false };
|
| struct {
|
| const std::string json;
|
| - const KeywordFetcherMatch matches[5];
|
| + const KeywordFetcherMatch matches[6];
|
| const std::string inline_autocompletion;
|
| } cases[] = {
|
| // Ensure that suggest relevance scores reorder matches and that
|
| @@ -1418,7 +1482,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "k a", false, true },
|
| { "c", true, false },
|
| { "b", true, false },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| // Again, check that relevance scores reorder matches, just this
|
| // time with navigation matches. This also checks that with
|
| @@ -1436,7 +1500,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "d", true, false },
|
| { "c.com", false, false },
|
| { "b.com", false, false },
|
| - { "k a", false, true }, },
|
| + { "k a", false, true },
|
| + kEmptyMatch },
|
| std::string() },
|
|
|
| // Without suggested relevance scores, we should only allow one
|
| @@ -1446,7 +1511,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "b.com", false, false },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that verbatimrelevance scores reorder or suppress verbatim.
|
| @@ -1456,27 +1521,27 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "a1", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":9998,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| { { "a1", true, true },
|
| { "a", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| { { "a1", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":-1,"
|
| "\"google:suggestrelevance\":[9999]}]",
|
| { { "a1", true, true },
|
| { "a", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| "1" },
|
| { "[\"a\",[\"http://a.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| @@ -1485,7 +1550,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "a.com", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that both types of relevance scores reorder matches together.
|
| @@ -1495,7 +1560,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a", true, true },
|
| { "a2", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| "1" },
|
|
|
| // Ensure that only inlinable matches may be ranked as the highest result.
|
| @@ -1504,14 +1569,14 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "b", true, false },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999],"
|
| "\"google:verbatimrelevance\":0}]",
|
| { { "a", true, true },
|
| { "b", true, false },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| @@ -1519,7 +1584,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "b.com", false, false },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| @@ -1528,7 +1593,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "b.com", false, false },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that the top result is ranked as highly as calculated verbatim.
|
| @@ -1539,13 +1604,13 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "a1", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":1}]",
|
| { { "a", true, true },
|
| { "a1", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch},
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| // Continuing the same category of tests, but make sure we keep the
|
| // suggested relevance scores even as we discard the verbatim relevance
|
| @@ -1555,7 +1620,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "k a", false, true },
|
| { "a1", true, true },
|
| - kEmptyMatch, kEmptyMatch},
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 2],"
|
| "\"google:verbatimrelevance\":0}]",
|
| @@ -1563,7 +1628,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "k a", false, true },
|
| { "a2", true, true },
|
| { "a1", true, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 3],"
|
| "\"google:verbatimrelevance\":2}]",
|
| @@ -1571,7 +1636,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "k a", false, true },
|
| { "a2", true, true },
|
| { "a1", true, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that all suggestions are considered, regardless of order.
|
| @@ -1581,7 +1646,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "k a", false, true },
|
| { "h", true, false },
|
| { "g", true, false },
|
| - { "f", true, false } },
|
| + { "f", true, false },
|
| + { "e", true, false } },
|
| std::string() },
|
| { "[\"a\",[\"http://b.com\", \"http://c.com\", \"http://d.com\","
|
| "\"http://e.com\", \"http://f.com\", \"http://g.com\","
|
| @@ -1595,7 +1661,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "k a", false, true },
|
| { "h.com", false, false },
|
| { "g.com", false, false },
|
| - { "f.com", false, false } },
|
| + { "f.com", false, false },
|
| + { "e.com", false, false } },
|
| std::string() },
|
|
|
| // Ensure that incorrectly sized suggestion relevance lists are ignored.
|
| @@ -1606,13 +1673,13 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a1", true, true },
|
| { "a2", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]",
|
| { { "a", true, true },
|
| { "a1", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch},
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| // In this case, ignored the suggested relevance scores means we keep
|
| // only one navsuggest result.
|
| @@ -1622,7 +1689,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "a1.com", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch},
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a1.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| @@ -1630,7 +1697,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "a1.com", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch},
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Ensure that all 'verbatim' results are merged with their maximum score.
|
| @@ -1640,7 +1707,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a", true, true },
|
| { "a1", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| "2" },
|
| { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
|
| "{\"google:suggestrelevance\":[9998, 9997, 9999],"
|
| @@ -1649,7 +1716,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a", true, true },
|
| { "a1", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| "2" },
|
|
|
| // Ensure that verbatim is always generated without other suggestions.
|
| @@ -1658,12 +1725,12 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "[\"a\",[],[],[],{\"google:verbatimrelevance\":1}]",
|
| { { "a", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch, kEmptyMatch},
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]",
|
| { { "a", true, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch, kEmptyMatch},
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
|
|
| // Check that navsuggestions will be demoted below queries.
|
| @@ -1679,7 +1746,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a2.com", false, true },
|
| { "a1.com", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
|
| @@ -1689,7 +1756,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a1.com", false, true },
|
| { "a2.com", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"https://a/\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\"],"
|
| @@ -1697,8 +1764,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "https://a", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch,
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| // Check when navsuggest scores more than verbatim and there is query
|
| // suggestion but it scores lower.
|
| @@ -1710,7 +1776,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a2.com", false, true },
|
| { "a1.com", false, true },
|
| { "a3", true, true },
|
| - { "k a", false, true } },
|
| + { "k a", false, true },
|
| + kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
|
| @@ -1720,7 +1787,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a1.com", false, true },
|
| { "a2.com", false, true },
|
| { "a3", true, true },
|
| - { "k a", false, true } },
|
| + { "k a", false, true },
|
| + kEmptyMatch },
|
| std::string() },
|
| // Check when navsuggest scores more than a query suggestion. There is
|
| // a verbatim but it scores lower.
|
| @@ -1732,7 +1800,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a2.com", false, true },
|
| { "a1.com", false, true },
|
| { "a", true, true },
|
| - { "k a", false, true } },
|
| + { "k a", false, true },
|
| + kEmptyMatch },
|
| "3" },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
|
| @@ -1742,7 +1811,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a1.com", false, true },
|
| { "a2.com", false, true },
|
| { "a", true, true },
|
| - { "k a", false, true } },
|
| + { "k a", false, true },
|
| + kEmptyMatch },
|
| "3" },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
|
| @@ -1752,7 +1822,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a2.com", false, true },
|
| { "a1.com", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| "3" },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
|
| @@ -1762,7 +1832,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a1.com", false, true },
|
| { "a2.com", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch },
|
| + kEmptyMatch, kEmptyMatch },
|
| "3" },
|
| // Check when there is neither verbatim nor a query suggestion that,
|
| // because we can't demote navsuggestions below a query suggestion,
|
| @@ -1778,7 +1848,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "a2.com", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch},
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
|
| @@ -1787,7 +1857,7 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { { "a", true, true },
|
| { "a1.com", false, true },
|
| { "k a", false, true },
|
| - kEmptyMatch, kEmptyMatch},
|
| + kEmptyMatch, kEmptyMatch, kEmptyMatch },
|
| std::string() },
|
| // More checks that everything works when it's not necessary to demote.
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
|
| @@ -1798,7 +1868,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a2.com", false, true },
|
| { "a1.com", false, true },
|
| { "a", true, true },
|
| - { "k a", false, true } },
|
| + { "k a", false, true },
|
| + kEmptyMatch },
|
| "3" },
|
| { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
|
| "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
|
| @@ -1808,7 +1879,8 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| { "a1.com", false, true },
|
| { "a2.com", false, true },
|
| { "a", true, true },
|
| - { "k a", false, true } },
|
| + { "k a", false, true },
|
| + kEmptyMatch },
|
| "3" },
|
| };
|
|
|
| @@ -1861,10 +1933,6 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
|
| }
|
|
|
| TEST_F(SearchProviderTest, LocalAndRemoteRelevances) {
|
| - // Enable Instant Extended in order to allow an increased number of
|
| - // suggestions.
|
| - chrome::EnableInstantExtendedAPIForTesting();
|
| -
|
| // We hardcode the string "term1" below, so ensure that the search term that
|
| // got added to history already is that string.
|
| ASSERT_EQ(ASCIIToUTF16("term1"), term1_);
|
|
|