| 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 764f3c34329b783d9fe04e5ec18a82621bf2a71d..80efb77344034a50d7ae7952ce513a0b704f70b3 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"
|
| @@ -914,138 +913,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\","
|
| @@ -1056,45 +1080,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() },
|
| };
|
|
|
| @@ -1145,133 +1177,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\","
|
| @@ -1282,45 +1338,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() },
|
| };
|
|
|
| @@ -1382,7 +1446,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
|
| @@ -1393,7 +1457,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
|
| @@ -1411,7 +1475,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
|
| @@ -1421,7 +1486,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.
|
| @@ -1431,27 +1496,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\"],"
|
| @@ -1460,7 +1525,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.
|
| @@ -1470,7 +1535,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.
|
| @@ -1479,14 +1544,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\"],"
|
| @@ -1494,7 +1559,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\"],"
|
| @@ -1503,7 +1568,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.
|
| @@ -1514,13 +1579,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
|
| @@ -1530,7 +1595,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}]",
|
| @@ -1538,7 +1603,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}]",
|
| @@ -1546,7 +1611,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.
|
| @@ -1556,7 +1621,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\","
|
| @@ -1570,7 +1636,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.
|
| @@ -1581,13 +1648,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.
|
| @@ -1597,7 +1664,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\"],"
|
| @@ -1605,7 +1672,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.
|
| @@ -1615,7 +1682,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],"
|
| @@ -1624,7 +1691,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.
|
| @@ -1633,12 +1700,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.
|
| @@ -1654,7 +1721,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\"],"
|
| @@ -1664,7 +1731,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\"],"
|
| @@ -1672,8 +1739,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.
|
| @@ -1685,7 +1751,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\"],"
|
| @@ -1695,7 +1762,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.
|
| @@ -1707,7 +1775,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\"],"
|
| @@ -1717,7 +1786,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\"],"
|
| @@ -1727,7 +1797,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\"],"
|
| @@ -1737,7 +1807,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,
|
| @@ -1753,7 +1823,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\"],"
|
| @@ -1762,7 +1832,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\"],[],[],"
|
| @@ -1773,7 +1843,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\"],"
|
| @@ -1783,7 +1854,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" },
|
| };
|
|
|
| @@ -1836,10 +1908,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_);
|
|
|