Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / autocomplete / search_provider_unittest.cc
index 968f531..3cb2496 100644 (file)
@@ -30,7 +30,6 @@
 #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"
-#include "chrome/browser/signin/signin_manager.h"
 #include "chrome/browser/signin/signin_manager_factory.h"
 #include "chrome/browser/sync/profile_sync_service.h"
 #include "chrome/browser/sync/profile_sync_service_factory.h"
@@ -39,6 +38,7 @@
 #include "chrome/common/pref_names.h"
 #include "chrome/test/base/testing_browser_process.h"
 #include "chrome/test/base/testing_profile.h"
+#include "components/signin/core/browser/signin_manager.h"
 #include "components/sync_driver/pref_names.h"
 #include "components/variations/entropy_provider.h"
 #include "content/public/test/test_browser_thread_bundle.h"
@@ -254,7 +254,7 @@ void SearchProviderTest::SetUp() {
   data.search_terms_replacement_key = "strk";
   default_t_url_ = new TemplateURL(&profile_, data);
   turl_model->Add(default_t_url_);
-  turl_model->SetDefaultSearchProvider(default_t_url_);
+  turl_model->SetUserSelectedDefaultSearchProvider(default_t_url_);
   TemplateURLID default_provider_id = default_t_url_->id();
   ASSERT_NE(0, default_provider_id);
 
@@ -297,8 +297,7 @@ void SearchProviderTest::RunTest(TestData* cases,
     AutocompleteInput input(cases[i].input, base::string16::npos,
                             base::string16(), GURL(),
                             AutocompleteInput::INVALID_SPEC, false,
-                            prefer_keyword, true,
-                            AutocompleteInput::ALL_MATCHES);
+                            prefer_keyword, true, true);
     provider_->Start(input, false);
     matches = provider_->matches();
     base::string16 diagnostic_details =
@@ -345,7 +344,7 @@ void SearchProviderTest::QueryForInput(const base::string16& text,
   AutocompleteInput input(text, base::string16::npos, base::string16(), GURL(),
                           AutocompleteInput::INVALID_SPEC,
                           prevent_inline_autocomplete, prefer_keyword, true,
-                          AutocompleteInput::ALL_MATCHES);
+                          true);
   provider_->Start(input, false);
 
   // RunUntilIdle so that the task scheduled by SearchProvider to create the
@@ -869,8 +868,7 @@ TEST_F(SearchProviderTest, KeywordOrderingAndDescriptions) {
       AutocompleteProvider::TYPE_SEARCH);
   controller.Start(AutocompleteInput(
       ASCIIToUTF16("k t"), base::string16::npos, base::string16(), GURL(),
-      AutocompleteInput::INVALID_SPEC, false, false, true,
-      AutocompleteInput::ALL_MATCHES));
+      AutocompleteInput::INVALID_SPEC, false, false, true, true));
   const AutocompleteResult& result = controller.result();
 
   // There should be three matches, one for the keyword history, one for
@@ -1023,7 +1021,7 @@ TEST_F(SearchProviderTest, CommandLineOverrides) {
   data.SetURL("{google:baseURL}{searchTerms}");
   default_t_url_ = new TemplateURL(&profile_, data);
   turl_model->Add(default_t_url_);
-  turl_model->SetDefaultSearchProvider(default_t_url_);
+  turl_model->SetUserSelectedDefaultSearchProvider(default_t_url_);
 
   CommandLine::ForCurrentProcess()->AppendSwitchASCII(switches::kGoogleBaseURL,
                                                       "http://www.bar.com/");
@@ -1190,279 +1188,6 @@ TEST_F(SearchProviderTest, DefaultFetcherSuggestRelevance) {
   } cases[] = {
     // Ensure that suggestrelevance scores reorder matches.
     { "[\"a\",[\"b\", \"c\"],[],[],{\"google:suggestrelevance\":[1, 2]}]",
-      { { "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,
-        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,
-        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, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":9998,"
-                             "\"google:suggestrelevance\":[9999]}]",
-      { { "a1", true }, { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
-        kEmptyMatch },
-      "1" },
-    { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0,"
-                             "\"google:suggestrelevance\":[9999]}]",
-      { { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
-        kEmptyMatch },
-      "1" },
-    { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":-1,"
-                             "\"google:suggestrelevance\":[9999]}]",
-      { { "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, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"http://a.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\"],"
-        "\"google:verbatimrelevance\":9998,"
-        "\"google:suggestrelevance\":[9999]}]",
-      { { "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, kEmptyMatch,
-        kEmptyMatch },
-      ".com" },
-    { "[\"a\",[\"http://a.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\"],"
-        "\"google:verbatimrelevance\":-1,"
-        "\"google:suggestrelevance\":[9999]}]",
-      { { "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, 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, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"b\"],[],[],{\"google:suggestrelevance\":[9999],"
-                            "\"google:verbatimrelevance\":0}]",
-      { { "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,
-        kEmptyMatch, kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"http://b.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\"],"
-        "\"google:suggestrelevance\":[9999],"
-        "\"google:verbatimrelevance\":0}]",
-      { { "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,
-        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, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":1}]",
-      { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[1],"
-                             "\"google:verbatimrelevance\":0}]",
-      { { "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, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 3],"
-      "\"google:verbatimrelevance\":2}]",
-      { { "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, 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,
-        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 },
-        {"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\","
-              "\"http://h.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\","
-                                "\"NAVIGATION\", \"NAVIGATION\","
-                                "\"NAVIGATION\", \"NAVIGATION\","
-                                "\"NAVIGATION\"],"
-        "\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
-      { { "a", true }, { "h.com", false }, { "g.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, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]",
-      { { "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,
-        kEmptyMatch, kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"http://a1.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\"],"
-       "\"google:suggestrelevance\":[9999, 1]}]",
-      { { "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, kEmptyMatch,
-        kEmptyMatch },
-      "2" },
-    { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
-       "{\"google:suggestrelevance\":[9998, 9997, 9999],"
-        "\"google:verbatimrelevance\":0}]",
-      { { "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, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]",
-      { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-  };
-
-  std::map<std::string, std::string> params;
-  params[std::string(OmniboxFieldTrial::kReorderForLegalDefaultMatchRule) +
-      ":*:*"] = OmniboxFieldTrial::kReorderForLegalDefaultMatchRuleDisabled;
-  ASSERT_TRUE(chrome_variations::AssociateVariationParams(
-      OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params));
-  base::FieldTrialList::CreateFieldTrial(
-      OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");
-
-  for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
-    QueryForInput(ASCIIToUTF16("a"), false, false);
-    net::TestURLFetcher* fetcher =
-        test_factory_.GetFetcherByID(
-            SearchProvider::kDefaultProviderURLFetcherID);
-    ASSERT_TRUE(fetcher);
-    fetcher->set_response_code(200);
-    fetcher->SetResponseString(cases[i].json);
-    fetcher->delegate()->OnURLFetchComplete(fetcher);
-    RunTillProviderDone();
-
-    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());
-    EXPECT_EQ(ASCIIToUTF16(cases[i].inline_autocompletion),
-              matches[0].inline_autocompletion) << description;
-    EXPECT_GE(matches[0].relevance, 1300) << description;
-
-    ASSERT_LE(matches.size(), ARRAYSIZE_UNSAFE(cases[i].matches));
-    size_t j = 0;
-    // Ensure that the returned matches equal the expectations.
-    for (; j < matches.size(); ++j) {
-      EXPECT_EQ(ASCIIToUTF16(cases[i].matches[j].contents),
-                matches[j].contents) << description;
-      EXPECT_EQ(cases[i].matches[j].allowed_to_be_default_match,
-                matches[j].allowed_to_be_default_match) << description;
-    }
-    // Ensure that no expected matches are missing.
-    for (; j < ARRAYSIZE_UNSAFE(cases[i].matches); ++j)
-      EXPECT_EQ(kNotApplicable, cases[i].matches[j].contents) <<
-          "Case # " << i << " " << description;
-  }
-}
-
-// This test is like DefaultFetcherSuggestRelevance above except it enables
-// the field trial that causes the omnibox to be willing to reorder matches
-// to guarantee the top result is a legal default match.  This field trial
-// causes SearchProvider to allow some constraints to be violated that it
-// wouldn't normally because the omnibox will fix the problems later.
-TEST_F(SearchProviderTest, DefaultFetcherSuggestRelevanceWithReorder) {
-  struct DefaultFetcherMatch {
-    std::string contents;
-    bool allowed_to_be_default_match;
-  };
-  const DefaultFetcherMatch kEmptyMatch = { kNotApplicable, false };
-  struct {
-    const std::string json;
-    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, kEmptyMatch,
         kEmptyMatch },
       std::string() },
@@ -1588,589 +1313,107 @@ TEST_F(SearchProviderTest, DefaultFetcherSuggestRelevanceWithReorder) {
       "\"google:verbatimrelevance\":2}]",
       { { "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, 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,
-        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 },
-        { "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\","
-              "\"http://h.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\","
-                                "\"NAVIGATION\", \"NAVIGATION\","
-                                "\"NAVIGATION\", \"NAVIGATION\","
-                                "\"NAVIGATION\"],"
-        "\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
-      { { "a", true }, { "h.com", false }, { "g.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, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]",
-      { { "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,
-        kEmptyMatch, kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"http://a1.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\"],"
-       "\"google:suggestrelevance\":[9999, 1]}]",
-      { { "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, kEmptyMatch,
-        kEmptyMatch },
-      "2" },
-    { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
-       "{\"google:suggestrelevance\":[9998, 9997, 9999],"
-        "\"google:verbatimrelevance\":0}]",
-      { { "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, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-    { "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]",
-      { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
-        kEmptyMatch },
-      std::string() },
-  };
-
-  for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
-    QueryForInput(ASCIIToUTF16("a"), false, false);
-    net::TestURLFetcher* fetcher =
-        test_factory_.GetFetcherByID(
-            SearchProvider::kDefaultProviderURLFetcherID);
-    ASSERT_TRUE(fetcher);
-    fetcher->set_response_code(200);
-    fetcher->SetResponseString(cases[i].json);
-    fetcher->delegate()->OnURLFetchComplete(fetcher);
-    RunTillProviderDone();
-
-    const std::string description = "for input with json=" + cases[i].json;
-    const ACMatches& matches = provider_->matches();
-    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 = FindDefaultMatch(matches);
-    ASSERT_NE(matches.end(), it);
-    EXPECT_EQ(ASCIIToUTF16(cases[i].inline_autocompletion),
-              it->inline_autocompletion) << description;
-
-    ASSERT_LE(matches.size(), ARRAYSIZE_UNSAFE(cases[i].matches));
-    size_t j = 0;
-    // Ensure that the returned matches equal the expectations.
-    for (; j < matches.size(); ++j) {
-      EXPECT_EQ(ASCIIToUTF16(cases[i].matches[j].contents),
-                matches[j].contents) << description;
-      EXPECT_EQ(cases[i].matches[j].allowed_to_be_default_match,
-                matches[j].allowed_to_be_default_match) << description;
-    }
-    // Ensure that no expected matches are missing.
-    for (; j < ARRAYSIZE_UNSAFE(cases[i].matches); ++j)
-      EXPECT_EQ(kNotApplicable, cases[i].matches[j].contents) <<
-          "Case # " << i << " " << description;
-  }
-}
-
-// Verifies that suggest results with relevance scores are added
-// properly when using the keyword fetcher.  This is similar to the
-// test DefaultFetcherSuggestRelevance above but this uses inputs that
-// trigger keyword suggestions (i.e., "k a" rather than "a") and has
-// different expectations (because now the results are a mix of
-// keyword suggestions and default provider suggestions).  When a new
-// test is added to this TEST_F, please consider if it would be
-// appropriate to add to DefaultFetcherSuggestRelevance as well.
-TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
-  struct KeywordFetcherMatch {
-    std::string contents;
-    bool from_keyword;
-    bool allowed_to_be_default_match;
-  };
-  const KeywordFetcherMatch kEmptyMatch = { kNotApplicable, false, false };
-  struct {
-    const std::string json;
-    const KeywordFetcherMatch matches[6];
-    const std::string inline_autocompletion;
-  } cases[] = {
-    // Ensure that suggest relevance scores reorder matches and that
-    // the keyword verbatim (lacking a suggested verbatim score) beats
-    // the default provider verbatim.
-    { "[\"a\",[\"b\", \"c\"],[],[],{\"google:suggestrelevance\":[1, 2]}]",
-      { { "a",   true,  true },
-        { "k a", false, false },
-        { "c",   true,  false },
-        { "b",   true,  false },
-        kEmptyMatch, kEmptyMatch },
-      std::string() },
-    // 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.
-    // 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]}]",
-      { { "a",     true,  true },
-        { "d",     true,  false },
-        { "c.com", false, false },
-        { "b.com", false, false },
-        { "k a",   false, false },
-        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,  true },
-        { "b.com", false, false },
-        { "k a",   false, false },
-        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,  true },
-        { "a1",  true,  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, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
-      "1" },
-    { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0,"
-                             "\"google:suggestrelevance\":[9999]}]",
-      { { "a1",  true,  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, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
-      "1" },
-    { "[\"a\",[\"http://a.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\"],"
-        "\"google:verbatimrelevance\":9999,"
-        "\"google:suggestrelevance\":[9998]}]",
-      { { "a",     true,  true },
-        { "a.com", false, false },
-        { "k a",   false, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
-      std::string() },
-
-    // Ensure that both types of relevance scores reorder matches together.
-    { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[9999, 9997],"
-                                     "\"google:verbatimrelevance\":9998}]",
-      { { "a1",  true,  true },
-        { "a",   true,  true },
-        { "a2",  true,  true },
-        { "k a", false, false },
-        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,  true },
-        { "b",   true,  false },
-        { "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, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"http://b.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\"],"
-        "\"google:suggestrelevance\":[9999]}]",
-      { { "a",     true,  true },
-        { "b.com", false, false },
-        { "k a",   false, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"http://b.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\"],"
-        "\"google:suggestrelevance\":[9999],"
-        "\"google:verbatimrelevance\":0}]",
-      { { "a",     true,  true },
-        { "b.com", false, false },
-        { "k a",   false, false },
-        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.
-    // Note that keyword suggestions by default (not in suggested relevance
-    // mode) score more highly than the default verbatim.
-    { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":0}]",
-      { { "a",   true,  true },
-        { "a1",  true,  true },
-        { "k a", false, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"a1\"],[],[],{\"google:verbatimrelevance\":1}]",
-      { { "a",   true,  true },
-        { "a1",  true,  true },
-        { "k a", false, false },
-        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
-    // scores.
-    { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[1],"
-                             "\"google:verbatimrelevance\":0}]",
-      { { "a",   true,  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, false },
-        { "a2",  true,  true },
-        { "a1",  true,  true },
-        kEmptyMatch, kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1, 3],"
-      "\"google:verbatimrelevance\":2}]",
-      { { "a",   true,  true },
-        { "k a", false, false },
-        { "a2",  true,  true },
-        { "a1",  true,  true },
-        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,  true },
-        { "k a", false, false },
-        { "h",   true,  false },
-        { "g",   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\","
-              "\"http://h.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\","
-                                "\"NAVIGATION\", \"NAVIGATION\","
-                                "\"NAVIGATION\", \"NAVIGATION\","
-                                "\"NAVIGATION\"],"
-        "\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
-      { { "a",     true,  true },
-        { "k a",   false, false },
-        { "h.com", false, false },
-        { "g.com", false, false },
-        { "f.com", false, false },
-        { "e.com", false, false } },
-      std::string() },
-
-    // Ensure that incorrectly sized suggestion relevance lists are ignored.
-    // Note that keyword suggestions by default (not in suggested relevance
-    // mode) score more highly than the default verbatim.
-    { "[\"a\",[\"a1\", \"a2\"],[],[],{\"google:suggestrelevance\":[1]}]",
-      { { "a",   true,  true },
-        { "a1",  true,  true },
-        { "a2",  true,  true },
-        { "k a", false, false },
-        kEmptyMatch, kEmptyMatch },
-      std::string() },
-    { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]",
-      { { "a",   true,  true },
-        { "a1",  true,  true },
-        { "k a", false, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
-      std::string() },
-    // In this case, ignoring the suggested relevance scores means we keep
-    // only one navsuggest result.
-    { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
-        "\"google:suggestrelevance\":[1]}]",
-      { { "a",      true,  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, false },
-        { "k a",    false, false },
-        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,  true },
-        { "a",   true,  true },
-        { "a1",  true,  true },
-        { "k a", false, false },
-        kEmptyMatch, kEmptyMatch },
-      "2" },
-    { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
-       "{\"google:suggestrelevance\":[9998, 9997, 9999],"
-        "\"google:verbatimrelevance\":0}]",
-      { { "a2",  true,  true },
-        { "a",   true,  true },
-        { "a1",  true,  true },
-        { "k a", false, false },
-        kEmptyMatch, kEmptyMatch },
-      "2" },
-
-    // Ensure that verbatim is always generated without other suggestions.
-    // TODO(mpearson): Ensure the value of verbatimrelevance is respected
-    // (except when suggested relevances are ignored).
-    { "[\"a\",[],[],[],{\"google:verbatimrelevance\":1}]",
-      { { "a",   true,  true },
-        { "k a", false, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch },
-      std::string() },
-    { "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]",
-      { { "a",   true,  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.
-    { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
-        "\"google:verbatimrelevance\":9990,"
-        "\"google:suggestrelevance\":[9998, 9999]}]",
-      { { "a",      true,  true },
-        { "a2.com", false, false },
-        { "a1.com", false, false },
-        { "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, 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, false },
-        { "k a",       false, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
-      std::string() },
-    // Check when navsuggest scores more than verbatim and there is query
-    // suggestion but it scores lower.
-    { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
-        "\"google:verbatimrelevance\":9990,"
-        "\"google:suggestrelevance\":[9998, 9999, 1300]}]",
-      { { "a",      true,  true },
-        { "a2.com", false, false },
-        { "a1.com", false, false },
-        { "a3",     true,  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, false },
-        { "a2.com", false, false },
-        { "a3",     true,  true },
-        { "k a",    false, false },
-        kEmptyMatch },
-      std::string() },
-    // Check when navsuggest scores more than a query suggestion.  There is
-    // a verbatim but it scores lower.
-    { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
-        "\"google:verbatimrelevance\":9990,"
-        "\"google:suggestrelevance\":[9998, 9999, 9997]}]",
-      { { "a3",     true,  true },
-        { "a2.com", false, false },
-        { "a1.com", false, false },
-        { "a",      true,  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, false },
-        { "a2.com", false, false },
-        { "a",      true,  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, false },
-        { "a1.com", false, false },
-        { "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, false },
-        { "a2.com", false, false },
-        { "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.
+      "2" },
+    { "[\"a\",[\"http://a.com\"],[],[],"
+       "{\"google:suggesttype\":[\"NAVIGATION\"],"
+        "\"google:suggestrelevance\":[1],"
+        "\"google:verbatimrelevance\":0}]",
+      { { "a.com", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
+        kEmptyMatch },
+      ".com" },
     { "[\"a\",[\"http://a1.com\", \"http://a2.com\"],[],[],"
        "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\"],"
-        "\"google:verbatimrelevance\":0,"
-        "\"google:suggestrelevance\":[9998, 9999]}]",
-      { { "a",      true,  true },
-        { "a2.com", false, false },
-        { "k a",    false, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
+        "\"google:suggestrelevance\":[1, 2],"
+        "\"google:verbatimrelevance\":0}]",
+      { { "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 },
+        { "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\","
+              "\"http://h.com\"],[],[],"
+       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\","
+                                "\"NAVIGATION\", \"NAVIGATION\","
+                                "\"NAVIGATION\", \"NAVIGATION\","
+                                "\"NAVIGATION\"],"
+        "\"google:suggestrelevance\":[1, 2, 3, 4, 5, 6, 7]}]",
+      { { "a", true }, { "h.com", false }, { "g.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, kEmptyMatch,
+        kEmptyMatch },
+      std::string() },
+    { "[\"a\",[\"a1\"],[],[],{\"google:suggestrelevance\":[9999, 1]}]",
+      { { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch, 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, false },
-        { "k a",    false, false },
-        kEmptyMatch, kEmptyMatch, kEmptyMatch },
+        "\"google:suggestrelevance\":[1]}]",
+      { { "a", true }, { "a1.com", true }, 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\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
-        "\"google:verbatimrelevance\":9990,"
-        "\"google:suggestrelevance\":[9997, 9998, 9999]}]",
-      { { "a3",     true,  true },
-        { "a2.com", false, false },
-        { "a1.com", false, false },
-        { "a",      true,  true },
-        { "k a",    false, false },
+    { "[\"a\",[\"http://a1.com\"],[],[],"
+       "{\"google:suggesttype\":[\"NAVIGATION\"],"
+       "\"google:suggestrelevance\":[9999, 1]}]",
+      { { "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, kEmptyMatch,
         kEmptyMatch },
-      "3" },
-    { "[\"a\",[\"http://a1.com\", \"http://a2.com\", \"a3\"],[],[],"
-       "{\"google:suggesttype\":[\"NAVIGATION\", \"NAVIGATION\", \"QUERY\"],"
-        "\"google:verbatimrelevance\":9990,"
-        "\"google:suggestrelevance\":[9998, 9997, 9999]}]",
-      { { "a3",     true,  true },
-        { "a1.com", false, false },
-        { "a2.com", false, false },
-        { "a",      true,  true },
-        { "k a",    false, false },
+      "2" },
+    { "[\"a\",[\"a\", \"a1\", \"a2\"],[],[],"
+       "{\"google:suggestrelevance\":[9998, 9997, 9999],"
+        "\"google:verbatimrelevance\":0}]",
+      { { "a2", true }, { "a", true }, { "a1", true }, kEmptyMatch, kEmptyMatch,
         kEmptyMatch },
-      "3" },
-  };
+      "2" },
 
-  std::map<std::string, std::string> params;
-  params[std::string(OmniboxFieldTrial::kReorderForLegalDefaultMatchRule) +
-      ":*:*"] = OmniboxFieldTrial::kReorderForLegalDefaultMatchRuleDisabled;
-  ASSERT_TRUE(chrome_variations::AssociateVariationParams(
-      OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params));
-  base::FieldTrialList::CreateFieldTrial(
-      OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");
+    // 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, kEmptyMatch,
+        kEmptyMatch },
+      std::string() },
+    { "[\"a\",[],[],[],{\"google:verbatimrelevance\":0}]",
+      { { "a", true }, kEmptyMatch, kEmptyMatch, kEmptyMatch, kEmptyMatch,
+        kEmptyMatch },
+      std::string() },
+  };
 
   for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
-    QueryForInput(ASCIIToUTF16("k a"), false, true);
-
-    // Set up a default fetcher with no results.
-    net::TestURLFetcher* default_fetcher =
+    QueryForInput(ASCIIToUTF16("a"), false, false);
+    net::TestURLFetcher* fetcher =
         test_factory_.GetFetcherByID(
             SearchProvider::kDefaultProviderURLFetcherID);
-    ASSERT_TRUE(default_fetcher);
-    default_fetcher->set_response_code(200);
-    default_fetcher->delegate()->OnURLFetchComplete(default_fetcher);
-    default_fetcher = NULL;
-
-    // Set up a keyword fetcher with provided results.
-    net::TestURLFetcher* keyword_fetcher =
-        test_factory_.GetFetcherByID(
-            SearchProvider::kKeywordProviderURLFetcherID);
-    ASSERT_TRUE(keyword_fetcher);
-    keyword_fetcher->set_response_code(200);
-    keyword_fetcher->SetResponseString(cases[i].json);
-    keyword_fetcher->delegate()->OnURLFetchComplete(keyword_fetcher);
-    keyword_fetcher = NULL;
+    ASSERT_TRUE(fetcher);
+    fetcher->set_response_code(200);
+    fetcher->SetResponseString(cases[i].json);
+    fetcher->delegate()->OnURLFetchComplete(fetcher);
     RunTillProviderDone();
 
     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 = FindDefaultMatch(matches);
+    ASSERT_NE(matches.end(), it);
     EXPECT_EQ(ASCIIToUTF16(cases[i].inline_autocompletion),
-              matches[0].inline_autocompletion) << description;
-    EXPECT_GE(matches[0].relevance, 1300) << description;
+              it->inline_autocompletion) << description;
 
     ASSERT_LE(matches.size(), ARRAYSIZE_UNSAFE(cases[i].matches));
     size_t j = 0;
@@ -2178,8 +1421,6 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
     for (; j < matches.size(); ++j) {
       EXPECT_EQ(ASCIIToUTF16(cases[i].matches[j].contents),
                 matches[j].contents) << description;
-      EXPECT_EQ(cases[i].matches[j].from_keyword,
-                matches[j].keyword == ASCIIToUTF16("k")) << description;
       EXPECT_EQ(cases[i].matches[j].allowed_to_be_default_match,
                 matches[j].allowed_to_be_default_match) << description;
     }
@@ -2190,13 +1431,15 @@ TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
   }
 }
 
-// This test is like KeywordFetcherSuggestRelevance above except it
-// enables the field trial that causes the omnibox to be willing to
-// reorder matches to guarantee the top result is a legal default
-// match.  This field trial causes SearchProvider to allow some
-// constraints to be violated that it wouldn't normally because the
-// omnibox will fix the problems later.
-TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevanceWithReorder) {
+// Verifies that suggest results with relevance scores are added
+// properly when using the keyword fetcher.  This is similar to the
+// test DefaultFetcherSuggestRelevance above but this uses inputs that
+// trigger keyword suggestions (i.e., "k a" rather than "a") and has
+// different expectations (because now the results are a mix of
+// keyword suggestions and default provider suggestions).  When a new
+// test is added to this TEST_F, please consider if it would be
+// appropriate to add to DefaultFetcherSuggestRelevance as well.
+TEST_F(SearchProviderTest, KeywordFetcherSuggestRelevance) {
   struct KeywordFetcherMatch {
     std::string contents;
     bool from_keyword;
@@ -2761,128 +2004,6 @@ TEST_F(SearchProviderTest, DefaultProviderSuggestRelevanceScoringUrlInput) {
     const std::string json;
     const DefaultFetcherUrlInputMatch output[4];
   } cases[] = {
-    // Ensure topmost NAVIGATION matches are allowed for URL input.
-    { "a.com", "[\"a.com\",[\"http://a.com/a\"],[],[],"
-                "{\"google:suggesttype\":[\"NAVIGATION\"],"
-                 "\"google:suggestrelevance\":[9999]}]",
-      { { "a.com/a", AutocompleteMatchType::NAVSUGGEST,            true },
-        { "a.com",   AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
-        kEmptyMatch, kEmptyMatch } },
-    { "a.com", "[\"a.com\",[\"https://a.com\"],[],[],"
-                "{\"google:suggesttype\":[\"NAVIGATION\"],"
-                 "\"google:suggestrelevance\":[9999]}]",
-      { { "https://a.com", AutocompleteMatchType::NAVSUGGEST,            true },
-        { "a.com",         AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
-        kEmptyMatch, kEmptyMatch } },
-
-    // Ensure topmost SUGGEST matches are not allowed for URL input.
-    // SearchProvider disregards search and verbatim suggested relevances.
-    { "a.com", "[\"a.com\",[\"a.com info\"],[],[],"
-                "{\"google:suggestrelevance\":[9999]}]",
-      { { "a.com",      AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
-        { "a.com info", AutocompleteMatchType::SEARCH_SUGGEST,        true },
-        kEmptyMatch, kEmptyMatch } },
-    { "a.com", "[\"a.com\",[\"a.com/a\"],[],[],"
-                "{\"google:suggestrelevance\":[9999]}]",
-      { { "a.com",   AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
-        { "a.com/a", AutocompleteMatchType::SEARCH_SUGGEST,        true },
-        kEmptyMatch, kEmptyMatch } },
-
-    // Ensure the fallback mechanism allows inlinable NAVIGATION matches.
-    { "a.com", "[\"a.com\",[\"a.com/a\", \"http://a.com/b\"],[],[],"
-                "{\"google:suggesttype\":[\"QUERY\", \"NAVIGATION\"],"
-                 "\"google:suggestrelevance\":[9999, 9998]}]",
-      { { "a.com/b", AutocompleteMatchType::NAVSUGGEST,            true },
-        { "a.com",   AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
-        { "a.com/a", AutocompleteMatchType::SEARCH_SUGGEST,        true },
-        kEmptyMatch } },
-    { "a.com", "[\"a.com\",[\"a.com/a\", \"http://a.com/b\"],[],[],"
-                "{\"google:suggesttype\":[\"QUERY\", \"NAVIGATION\"],"
-                 "\"google:suggestrelevance\":[9998, 9997],"
-                 "\"google:verbatimrelevance\":9999}]",
-      { { "a.com/b", AutocompleteMatchType::NAVSUGGEST,            true },
-        { "a.com",   AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
-        { "a.com/a", AutocompleteMatchType::SEARCH_SUGGEST,        true },
-        kEmptyMatch } },
-
-    // Ensure the fallback mechanism disallows non-inlinable NAVIGATION matches.
-    { "a.com", "[\"a.com\",[\"a.com/a\", \"http://abc.com\"],[],[],"
-                "{\"google:suggesttype\":[\"QUERY\", \"NAVIGATION\"],"
-      "\"google:suggestrelevance\":[9999, 9998]}]",
-      { { "a.com",   AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
-        { "abc.com", AutocompleteMatchType::NAVSUGGEST,            false },
-        { "a.com/a", AutocompleteMatchType::SEARCH_SUGGEST,        true },
-        kEmptyMatch } },
-    { "a.com", "[\"a.com\",[\"a.com/a\", \"http://abc.com\"],[],[],"
-                "{\"google:suggesttype\":[\"QUERY\", \"NAVIGATION\"],"
-                 "\"google:suggestrelevance\":[9998, 9997],"
-                 "\"google:verbatimrelevance\":9999}]",
-      { { "a.com",   AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED, true },
-        { "abc.com", AutocompleteMatchType::NAVSUGGEST,            false },
-        { "a.com/a", AutocompleteMatchType::SEARCH_SUGGEST,        true },
-        kEmptyMatch } },
-  };
-
-  std::map<std::string, std::string> params;
-  params[std::string(OmniboxFieldTrial::kReorderForLegalDefaultMatchRule) +
-      ":*:*"] = OmniboxFieldTrial::kReorderForLegalDefaultMatchRuleDisabled;
-  ASSERT_TRUE(chrome_variations::AssociateVariationParams(
-      OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params));
-  base::FieldTrialList::CreateFieldTrial(
-      OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");
-
-  for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
-    QueryForInput(ASCIIToUTF16(cases[i].input), false, false);
-    net::TestURLFetcher* fetcher =
-        test_factory_.GetFetcherByID(
-            SearchProvider::kDefaultProviderURLFetcherID);
-    ASSERT_TRUE(fetcher);
-    fetcher->set_response_code(200);
-    fetcher->SetResponseString(cases[i].json);
-    fetcher->delegate()->OnURLFetchComplete(fetcher);
-    RunTillProviderDone();
-
-    size_t j = 0;
-    const ACMatches& matches = provider_->matches();
-    ASSERT_LE(matches.size(), ARRAYSIZE_UNSAFE(cases[i].output));
-    // Ensure that the returned matches equal the expectations.
-    for (; j < matches.size(); ++j) {
-      EXPECT_EQ(ASCIIToUTF16(cases[i].output[j].match_contents),
-                matches[j].contents);
-      EXPECT_EQ(cases[i].output[j].match_type, matches[j].type);
-      EXPECT_EQ(cases[i].output[j].allowed_to_be_default_match,
-                matches[j].allowed_to_be_default_match);
-    }
-    // Ensure that no expected matches are missing.
-    for (; j < ARRAYSIZE_UNSAFE(cases[i].output); ++j) {
-      EXPECT_EQ(kNotApplicable, cases[i].output[j].match_contents);
-      EXPECT_EQ(AutocompleteMatchType::NUM_TYPES,
-                cases[i].output[j].match_type);
-      EXPECT_FALSE(cases[i].output[j].allowed_to_be_default_match);
-    }
-  }
-}
-
-// This test is like DefaultProviderSuggestRelevanceScoringUrlInput
-// above except it enables the field trial that causes the omnibox to
-// be willing to reorder matches to guarantee the top result is a
-// legal default match.  This field trial causes SearchProvider to
-// allow some constraints to be violated that it wouldn't normally
-// because the omnibox will fix the problems later.
-TEST_F(SearchProviderTest,
-    DefaultProviderSuggestRelevanceScoringUrlInputWithReorder) {
-  struct DefaultFetcherUrlInputMatch {
-    const std::string match_contents;
-    AutocompleteMatch::Type match_type;
-    bool allowed_to_be_default_match;
-  };
-  const DefaultFetcherUrlInputMatch kEmptyMatch =
-      { kNotApplicable, AutocompleteMatchType::NUM_TYPES, false };
-  struct {
-    const std::string input;
-    const std::string json;
-    const DefaultFetcherUrlInputMatch output[4];
-  } cases[] = {
     // Ensure NAVIGATION matches are allowed to be listed first for URL
     // input regardless of whether the match is inlineable.  Note that
     // non-inlineable matches should not be allowed to be the default match.
@@ -3204,8 +2325,9 @@ TEST_F(SearchProviderTest, NavigationInline) {
     QueryForInput(ASCIIToUTF16(cases[i].input), false, false);
     AutocompleteMatch match(
         provider_->NavigationToMatch(SearchProvider::NavigationResult(
-            *provider_.get(), GURL(cases[i].url), base::string16(), false, 0,
-            false, ASCIIToUTF16(cases[i].input), std::string())));
+            *provider_.get(), GURL(cases[i].url),
+            AutocompleteMatchType::NAVSUGGEST, base::string16(), std::string(),
+            false, 0, false, ASCIIToUTF16(cases[i].input), std::string())));
     EXPECT_EQ(ASCIIToUTF16(cases[i].inline_autocompletion),
               match.inline_autocompletion);
     EXPECT_EQ(ASCIIToUTF16(cases[i].fill_into_edit), match.fill_into_edit);
@@ -3216,8 +2338,9 @@ TEST_F(SearchProviderTest, NavigationInline) {
     QueryForInput(ASCIIToUTF16(cases[i].input), true, false);
     AutocompleteMatch match_prevent_inline(
         provider_->NavigationToMatch(SearchProvider::NavigationResult(
-            *provider_.get(), GURL(cases[i].url), base::string16(), false, 0,
-            false, ASCIIToUTF16(cases[i].input), std::string())));
+            *provider_.get(), GURL(cases[i].url),
+            AutocompleteMatchType::NAVSUGGEST, base::string16(), std::string(),
+            false, 0, false, ASCIIToUTF16(cases[i].input), std::string())));
     EXPECT_EQ(ASCIIToUTF16(cases[i].inline_autocompletion),
               match_prevent_inline.inline_autocompletion);
     EXPECT_EQ(ASCIIToUTF16(cases[i].fill_into_edit),
@@ -3232,8 +2355,8 @@ TEST_F(SearchProviderTest, NavigationInlineSchemeSubstring) {
   const base::string16 input(ASCIIToUTF16("ht"));
   const base::string16 url(ASCIIToUTF16("http://a.com"));
   const SearchProvider::NavigationResult result(
-      *provider_.get(), GURL(url), base::string16(), false, 0, false,
-      input, std::string());
+      *provider_.get(), GURL(url), AutocompleteMatchType::NAVSUGGEST,
+      base::string16(), std::string(), false, 0, false, input, std::string());
 
   // Check the offset and strings when inline autocompletion is allowed.
   QueryForInput(input, false, false);
@@ -3256,8 +2379,9 @@ TEST_F(SearchProviderTest, NavigationInlineDomainClassify) {
   QueryForInput(ASCIIToUTF16("w"), false, false);
   AutocompleteMatch match(
       provider_->NavigationToMatch(SearchProvider::NavigationResult(
-          *provider_.get(), GURL("http://www.wow.com"), base::string16(), false,
-          0, false, ASCIIToUTF16("w"), std::string())));
+          *provider_.get(), GURL("http://www.wow.com"),
+          AutocompleteMatchType::NAVSUGGEST, base::string16(), std::string(),
+          false, 0, false, ASCIIToUTF16("w"), std::string())));
   EXPECT_EQ(ASCIIToUTF16("ow.com"), match.inline_autocompletion);
   EXPECT_TRUE(match.allowed_to_be_default_match);
   EXPECT_EQ(ASCIIToUTF16("www.wow.com"), match.fill_into_edit);
@@ -3277,206 +2401,6 @@ TEST_F(SearchProviderTest, NavigationInlineDomainClassify) {
             match.contents_class[2].style);
 }
 
-TEST_F(SearchProviderTest, RemoveStaleResultsTest) {
-  // TODO(mpearson): Consider expanding this test to explicitly cover
-  // testing staleness for keyword results.
-  struct {
-    const std::string omnibox_input;
-    const int verbatim_relevance;
-    // These cached suggestions should already be sorted.
-    // The particular number 5 as the length of the array is
-    // unimportant; it's merely enough cached results to fully test
-    // the functioning of RemoveAllStaleResults().
-    struct {
-      const std::string suggestion;
-      const bool is_navigation_result;
-      const int relevance;
-      // |expect_match| is true if this result should survive
-      // RemoveAllStaleResults() filtering against |omnibox_input| below.
-      const bool expect_match;
-    } results[5];
-  } cases[] = {
-    // Simple case: multiple query suggestions and no navsuggestions.
-    // All query suggestions score less than search-what-you-typed and
-    // thus none should be filtered because none will appear first.
-    { "x", 1300,
-      { { "food",         false, 1299, true  },
-        { "foobar",       false, 1298, true  },
-        { "crazy",        false, 1297, true  },
-        { "friend",       false, 1296, true  },
-        { kNotApplicable, false, 0,    false } } },
-
-    // Similarly simple cases, but the query suggestion appears first.
-    { "f", 1200,
-      { { "food",         false, 1299, true  },
-        { "foobar",       false, 1298, true  },
-        { "crazy",        false, 1297, true  },
-        { "friend",       false, 1296, true  },
-        { kNotApplicable, false, 0,    false } } },
-    { "c", 1200,
-      { { "food",         false, 1299, false },
-        { "foobar",       false, 1298, false },
-        { "crazy",        false, 1297, true  },
-        { "friend",       false, 1296, true  },
-        { kNotApplicable, false, 0,    false } } },
-    { "x", 1200,
-      { { "food",         false, 1299, false },
-        { "foobar",       false, 1298, false },
-        { "crazy",        false, 1297, false },
-        { "friend",       false, 1296, false },
-        { kNotApplicable, false, 0,    false } } },
-
-    // The same sort of cases, just using a mix of queries and navsuggestions.
-    { "x", 1300,
-      { { "http://food.com/",   true,  1299, true },
-        { "foobar",             false, 1298, true },
-        { "http://crazy.com/",  true,  1297, true },
-        { "friend",             false, 1296, true },
-        { "http://friend.com/", true,  1295, true } } },
-    { "f", 1200,
-      { { "http://food.com/",   true,  1299, true },
-        { "foobar",             false, 1298, true },
-        { "http://crazy.com/",  true,  1297, true },
-        { "friend",             false, 1296, true },
-        { "http://friend.com/", true,  1295, true } } },
-    { "c", 1200,
-      { { "http://food.com/",   true,  1299, false },
-        { "foobar",             false, 1298, false },
-        { "http://crazy.com/",  true,  1297, true  },
-        { "friend",             false, 1296, true  },
-        { "http://friend.com/", true,  1295, true  } } },
-    { "x", 1200,
-      { { "http://food.com/",   true,  1299, false },
-        { "foobar",             false, 1298, false },
-        { "http://crazy.com/",  true,  1297, false },
-        { "friend",             false, 1296, false },
-        { "http://friend.com/", true,  1295, false } } },
-
-    // Run the three tests immediately above again, just with verbatim
-    // suppressed.  Note that in the last case, all results are filtered.
-    // Because verbatim is also suppressed, SearchProvider will realize
-    // in UpdateMatches() that it needs to restore verbatim to fulfill
-    // its constraints.  This restoration does not happen in
-    // RemoveAllStaleResults() and hence is not tested here.  This restoration
-    // is tested in the DefaultFetcherSuggestRelevance test.
-    { "f", 0,
-      { { "http://food.com/",   true,  1299, true },
-        { "foobar",             false, 1298, true },
-        { "http://crazy.com/",  true,  1297, true },
-        { "friend",             false, 1296, true },
-        { "http://friend.com/", true,  1295, true } } },
-    { "c", 0,
-      { { "http://food.com/",   true,  1299, false },
-        { "foobar",             false, 1298, false },
-        { "http://crazy.com/",  true,  1297, true  },
-        { "friend",             false, 1296, true  },
-        { "http://friend.com/", true,  1295, true  } } },
-    { "x", 0,
-      { { "http://food.com/",   true,  1299, false },
-        { "foobar",             false, 1298, false },
-        { "http://crazy.com/",  true,  1297, false },
-        { "friend",             false, 1296, false },
-        { "http://friend.com/", true,  1295, false } } },
-
-    // The same sort of tests again, just with verbatim with a score
-    // that would place it in between other suggestions.
-    { "f", 1290,
-      { { "http://food.com/",   true,  1299, true },
-        { "foobar",             false, 1288, true },
-        { "http://crazy.com/",  true,  1277, true },
-        { "friend",             false, 1266, true },
-        { "http://friend.com/", true,  1255, true } } },
-    { "c", 1290,
-      { { "http://food.com/",   true,  1299, false },
-        { "foobar",             false, 1288, true  },
-        { "http://crazy.com/",  true,  1277, true  },
-        { "friend",             false, 1266, true  },
-        { "http://friend.com/", true,  1255, true  } } },
-    { "c", 1270,
-      { { "http://food.com/",   true,  1299, false },
-        { "foobar",             false, 1288, false },
-        { "http://crazy.com/",  true,  1277, true  },
-        { "friend",             false, 1266, true  },
-        { "http://friend.com/", true,  1255, true  } } },
-    { "x", 1280,
-      { { "http://food.com/",   true,  1299, false },
-        { "foobar",             false, 1288, false },
-        { "http://crazy.com/",  true,  1277, true  },
-        { "friend",             false, 1266, true  },
-        { "http://friend.com/", true,  1255, true  } } },
-  };
-
-  std::map<std::string, std::string> params;
-  params[std::string(OmniboxFieldTrial::kReorderForLegalDefaultMatchRule) +
-      ":*:*"] = OmniboxFieldTrial::kReorderForLegalDefaultMatchRuleDisabled;
-  ASSERT_TRUE(chrome_variations::AssociateVariationParams(
-      OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A", params));
-  base::FieldTrialList::CreateFieldTrial(
-      OmniboxFieldTrial::kBundledExperimentFieldTrialName, "A");
-
-  for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) {
-    // Initialize cached results for this test case.
-    provider_->default_results_.verbatim_relevance =
-        cases[i].verbatim_relevance;
-    provider_->default_results_.navigation_results.clear();
-    provider_->default_results_.suggest_results.clear();
-    for (size_t j = 0; j < ARRAYSIZE_UNSAFE(cases[i].results); ++j) {
-      const std::string& suggestion = cases[i].results[j].suggestion;
-      if (suggestion == kNotApplicable)
-        break;
-      if (cases[i].results[j].is_navigation_result) {
-        provider_->default_results_.navigation_results.push_back(
-            SearchProvider::NavigationResult(
-                *provider_.get(), GURL(suggestion), base::string16(), false,
-                cases[i].results[j].relevance, false,
-                ASCIIToUTF16(cases[i].omnibox_input), std::string()));
-      } else {
-        provider_->default_results_.suggest_results.push_back(
-            SearchProvider::SuggestResult(
-                ASCIIToUTF16(suggestion), AutocompleteMatchType::SEARCH_SUGGEST,
-                ASCIIToUTF16(suggestion), base::string16(), base::string16(),
-                std::string(), std::string(), false,
-                cases[i].results[j].relevance, false, false,
-                ASCIIToUTF16(cases[i].omnibox_input)));
-      }
-    }
-
-    provider_->input_ = AutocompleteInput(
-        ASCIIToUTF16(cases[i].omnibox_input), base::string16::npos,
-        base::string16(), GURL(), AutocompleteInput::INVALID_SPEC, false, false,
-        true, AutocompleteInput::ALL_MATCHES);
-    provider_->RemoveAllStaleResults();
-
-    // Check cached results.
-    SearchProvider::SuggestResults::const_iterator sug_it =
-        provider_->default_results_.suggest_results.begin();
-    const SearchProvider::SuggestResults::const_iterator sug_end =
-        provider_->default_results_.suggest_results.end();
-    SearchProvider::NavigationResults::const_iterator nav_it =
-        provider_->default_results_.navigation_results.begin();
-    const SearchProvider::NavigationResults::const_iterator nav_end =
-        provider_->default_results_.navigation_results.end();
-    for (size_t j = 0; j < ARRAYSIZE_UNSAFE(cases[i].results); ++j) {
-      const std::string& suggestion = cases[i].results[j].suggestion;
-      if (suggestion == kNotApplicable)
-        continue;
-      if (!cases[i].results[j].expect_match)
-        continue;
-      if (cases[i].results[j].is_navigation_result) {
-        ASSERT_NE(nav_end, nav_it) << "Failed to find " << suggestion;
-        EXPECT_EQ(suggestion, nav_it->url().spec());
-        ++nav_it;
-      } else {
-        ASSERT_NE(sug_end, sug_it) << "Failed to find " << suggestion;
-        EXPECT_EQ(ASCIIToUTF16(suggestion), sug_it->suggestion());
-        ++sug_it;
-      }
-    }
-    EXPECT_EQ(sug_end, sug_it);
-    EXPECT_EQ(nav_end, nav_it);
-  }
-}
-
 #if !defined(OS_WIN)
 // Verify entity suggestion parsing.
 TEST_F(SearchProviderTest, ParseEntitySuggestion) {
@@ -3826,7 +2750,7 @@ TEST_F(SearchProviderTest, XSSIGuardedJSONParsing_ValidResponses) {
 }
 
 // Test that deletion url gets set on an AutocompleteMatch when available for a
-// personalized query.
+// personalized query or a personalized URL.
 TEST_F(SearchProviderTest, ParseDeletionUrl) {
    struct Match {
      std::string contents;
@@ -3838,38 +2762,66 @@ TEST_F(SearchProviderTest, ParseDeletionUrl) {
        kNotApplicable, "", AutocompleteMatchType::NUM_TYPES
    };
 
-   const char url[] = "https://www.google.com/complete/deleteitems"
-       "?delq=ab&client=chrome&deltok=xsrf123";
+   const char* url[] = {
+    "http://defaultturl/complete/deleteitems"
+       "?delq=ab&client=chrome&deltok=xsrf124",
+    "http://defaultturl/complete/deleteitems"
+       "?delq=www.amazon.com&client=chrome&deltok=xsrf123",
+     };
 
    struct {
        const std::string input_text;
        const std::string response_json;
-       const Match matches[4];
+       const Match matches[5];
      } cases[] = {
        // A deletion URL on a personalized query should be reflected in the
        // resulting AutocompleteMatch.
        { "a",
-         "[\"a\",[\"ab\", \"ac\"],[],[],"
-         "{\"google:suggesttype\":[\"PERSONALIZED_QUERY\",\"QUERY\"],"
-         "\"google:suggestrelevance\":[1, 2],"
+         "[\"a\",[\"ab\", \"ac\",\"www.amazon.com\"],[],[],"
+         "{\"google:suggesttype\":[\"PERSONALIZED_QUERY\",\"QUERY\","
+          "\"PERSONALIZED_NAVIGATION\"],"
+         "\"google:suggestrelevance\":[3, 2, 1],"
          "\"google:suggestdetail\":[{\"du\":"
-         "\"https://www.google.com/complete/deleteitems?delq=ab&client=chrome"
-         "&deltok=xsrf123\"}, {}]}]",
+         "\"/complete/deleteitems?delq=ab&client=chrome"
+          "&deltok=xsrf124\"}, {}, {\"du\":"
+         "\"/complete/deleteitems?delq=www.amazon.com&"
+         "client=chrome&deltok=xsrf123\"}]}]",
          { { "a", "", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED },
+           { "ab", url[0], AutocompleteMatchType::SEARCH_SUGGEST },
            { "ac", "", AutocompleteMatchType::SEARCH_SUGGEST },
-           { "ab", url, AutocompleteMatchType::SEARCH_SUGGEST },
+           { "www.amazon.com", url[1],
+              AutocompleteMatchType::NAVSUGGEST_PERSONALIZED },
            kEmptyMatch,
          },
        },
-       // Personalized queries without deletion URLs shouldn't cause errors.
+       // Personalized queries or a personalized URL without deletion URLs
+       // shouldn't cause errors.
        { "a",
          "[\"a\",[\"ab\", \"ac\"],[],[],"
-         "{\"google:suggesttype\":[\"PERSONALIZED_QUERY\",\"QUERY\"],"
+         "{\"google:suggesttype\":[\"PERSONALIZED_QUERY\",\"QUERY\","
+         "\"PERSONALIZED_NAVIGATION\"],"
          "\"google:suggestrelevance\":[1, 2],"
          "\"google:suggestdetail\":[{}, {}]}]",
          { { "a", "", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED },
            { "ac", "", AutocompleteMatchType::SEARCH_SUGGEST },
            { "ab", "", AutocompleteMatchType::SEARCH_SUGGEST },
+           { "www.amazon.com", "",
+              AutocompleteMatchType::NAVSUGGEST_PERSONALIZED },
+           kEmptyMatch,
+         },
+       },
+       // Personalized queries or a personalized URL without
+       // google:suggestdetail shouldn't cause errors.
+       { "a",
+         "[\"a\",[\"ab\", \"ac\"],[],[],"
+         "{\"google:suggesttype\":[\"PERSONALIZED_QUERY\",\"QUERY\","
+         "\"PERSONALIZED_NAVIGATION\"],"
+         "\"google:suggestrelevance\":[1, 2]}]",
+         { { "a", "", AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED },
+           { "ac", "", AutocompleteMatchType::SEARCH_SUGGEST },
+           { "ab", "", AutocompleteMatchType::SEARCH_SUGGEST },
+           { "www.amazon.com", "",
+              AutocompleteMatchType::NAVSUGGEST_PERSONALIZED },
            kEmptyMatch,
          },
        },