OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/omnibox/browser/history_url_provider.h" | 5 #include "components/omnibox/browser/history_url_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 expected2_true, arraysize(expected2_true)); | 900 expected2_true, arraysize(expected2_true)); |
901 } | 901 } |
902 | 902 |
903 TEST_F(HistoryURLProviderTest, CullSearchResults) { | 903 TEST_F(HistoryURLProviderTest, CullSearchResults) { |
904 // Set up a default search engine. | 904 // Set up a default search engine. |
905 TemplateURLData data; | 905 TemplateURLData data; |
906 data.SetShortName(ASCIIToUTF16("TestEngine")); | 906 data.SetShortName(ASCIIToUTF16("TestEngine")); |
907 data.SetKeyword(ASCIIToUTF16("TestEngine")); | 907 data.SetKeyword(ASCIIToUTF16("TestEngine")); |
908 data.SetURL("http://testsearch.com/?q={searchTerms}"); | 908 data.SetURL("http://testsearch.com/?q={searchTerms}"); |
909 TemplateURLService* template_url_service = client_->GetTemplateURLService(); | 909 TemplateURLService* template_url_service = client_->GetTemplateURLService(); |
910 TemplateURL* template_url = new TemplateURL(data); | 910 TemplateURL* template_url = |
911 template_url_service->Add(template_url); | 911 template_url_service->Add(base::MakeUnique<TemplateURL>(data)); |
912 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); | 912 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); |
913 template_url_service->Load(); | 913 template_url_service->Load(); |
914 | 914 |
915 // URLs we will be using, plus the visit counts they will initially get | 915 // URLs we will be using, plus the visit counts they will initially get |
916 // (the redirect set below will also increment the visit counts). We want | 916 // (the redirect set below will also increment the visit counts). We want |
917 // the results to be in A,B,C order. Note also that our visit counts are | 917 // the results to be in A,B,C order. Note also that our visit counts are |
918 // all high enough so that domain synthesizing won't get triggered. | 918 // all high enough so that domain synthesizing won't get triggered. |
919 struct TestCase { | 919 struct TestCase { |
920 const char* url; | 920 const char* url; |
921 int count; | 921 int count; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1118 // the default experimental scoring. | 1118 // the default experimental scoring. |
1119 autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 1119 autocomplete_->scoring_params_.experimental_scoring_enabled = true; |
1120 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), | 1120 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), |
1121 std::string(), false, output, max_matches)); | 1121 std::string(), false, output, max_matches)); |
1122 for (int j = 0; j < max_matches; ++j) { | 1122 for (int j = 0; j < max_matches; ++j) { |
1123 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 1123 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |
1124 matches_[j].relevance); | 1124 matches_[j].relevance); |
1125 } | 1125 } |
1126 } | 1126 } |
1127 } | 1127 } |
OLD | NEW |