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 "chrome/browser/autocomplete/history_url_provider.h" | 5 #include "chrome/browser/autocomplete/history_url_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 metrics::OmniboxEventProto::INVALID_SPEC, | 829 metrics::OmniboxEventProto::INVALID_SPEC, |
830 false, false, true, true, | 830 false, false, true, true, |
831 ChromeAutocompleteSchemeClassifier(profile_.get())); | 831 ChromeAutocompleteSchemeClassifier(profile_.get())); |
832 autocomplete_->Start(input, false, true); | 832 autocomplete_->Start(input, false, true); |
833 EXPECT_TRUE(autocomplete_->matches().empty()); | 833 EXPECT_TRUE(autocomplete_->matches().empty()); |
834 } | 834 } |
835 | 835 |
836 TEST_F(HistoryURLProviderTest, CullSearchResults) { | 836 TEST_F(HistoryURLProviderTest, CullSearchResults) { |
837 // Set up a default search engine. | 837 // Set up a default search engine. |
838 TemplateURLData data; | 838 TemplateURLData data; |
| 839 data.SetShortName(ASCIIToUTF16("TestEngine")); |
839 data.SetKeyword(ASCIIToUTF16("TestEngine")); | 840 data.SetKeyword(ASCIIToUTF16("TestEngine")); |
840 data.SetURL("http://testsearch.com/?q={searchTerms}"); | 841 data.SetURL("http://testsearch.com/?q={searchTerms}"); |
841 TemplateURLService* template_url_service = | 842 TemplateURLService* template_url_service = |
842 TemplateURLServiceFactory::GetForProfile(profile_.get()); | 843 TemplateURLServiceFactory::GetForProfile(profile_.get()); |
843 TemplateURL* template_url = new TemplateURL(data); | 844 TemplateURL* template_url = new TemplateURL(data); |
844 template_url_service->Add(template_url); | 845 template_url_service->Add(template_url); |
845 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); | 846 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); |
846 template_url_service->Load(); | 847 template_url_service->Load(); |
847 | 848 |
848 // URLs we will be using, plus the visit counts they will initially get | 849 // URLs we will be using, plus the visit counts they will initially get |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1058 // Test the experiment (scoring enabled). | 1059 // Test the experiment (scoring enabled). |
1059 autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 1060 autocomplete_->scoring_params_.experimental_scoring_enabled = true; |
1060 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), | 1061 ASSERT_NO_FATAL_FAILURE(RunTest(ASCIIToUTF16(test_cases[i].input), |
1061 std::string(), false, output, max_matches)); | 1062 std::string(), false, output, max_matches)); |
1062 for (int j = 0; j < max_matches; ++j) { | 1063 for (int j = 0; j < max_matches; ++j) { |
1063 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 1064 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |
1064 matches_[j].relevance); | 1065 matches_[j].relevance); |
1065 } | 1066 } |
1066 } | 1067 } |
1067 } | 1068 } |
OLD | NEW |