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/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 | 791 |
792 TEST_F(HistoryURLProviderTest, CullSearchResults) { | 792 TEST_F(HistoryURLProviderTest, CullSearchResults) { |
793 // Set up a default search engine. | 793 // Set up a default search engine. |
794 TemplateURLData data; | 794 TemplateURLData data; |
795 data.SetKeyword(ASCIIToUTF16("TestEngine")); | 795 data.SetKeyword(ASCIIToUTF16("TestEngine")); |
796 data.SetURL("http://testsearch.com/?q={searchTerms}"); | 796 data.SetURL("http://testsearch.com/?q={searchTerms}"); |
797 TemplateURLService* template_url_service = | 797 TemplateURLService* template_url_service = |
798 TemplateURLServiceFactory::GetForProfile(profile_.get()); | 798 TemplateURLServiceFactory::GetForProfile(profile_.get()); |
799 TemplateURL* template_url = new TemplateURL(profile_.get(), data); | 799 TemplateURL* template_url = new TemplateURL(profile_.get(), data); |
800 template_url_service->Add(template_url); | 800 template_url_service->Add(template_url); |
801 template_url_service->SetDefaultSearchProvider(template_url); | 801 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); |
802 template_url_service->Load(); | 802 template_url_service->Load(); |
803 | 803 |
804 // URLs we will be using, plus the visit counts they will initially get | 804 // URLs we will be using, plus the visit counts they will initially get |
805 // (the redirect set below will also increment the visit counts). We want | 805 // (the redirect set below will also increment the visit counts). We want |
806 // the results to be in A,B,C order. Note also that our visit counts are | 806 // the results to be in A,B,C order. Note also that our visit counts are |
807 // all high enough so that domain synthesizing won't get triggered. | 807 // all high enough so that domain synthesizing won't get triggered. |
808 struct TestCase { | 808 struct TestCase { |
809 const char* url; | 809 const char* url; |
810 int count; | 810 int count; |
811 } test_cases[] = { | 811 } test_cases[] = { |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 autocomplete_->scoring_params_.experimental_scoring_enabled = true; | 1014 autocomplete_->scoring_params_.experimental_scoring_enabled = true; |
1015 ASSERT_NO_FATAL_FAILURE( | 1015 ASSERT_NO_FATAL_FAILURE( |
1016 RunTest(ASCIIToUTF16(test_cases[i].input), | 1016 RunTest(ASCIIToUTF16(test_cases[i].input), |
1017 base::string16(), false, output, max_matches)); | 1017 base::string16(), false, output, max_matches)); |
1018 for (int j = 0; j < max_matches; ++j) { | 1018 for (int j = 0; j < max_matches; ++j) { |
1019 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, | 1019 EXPECT_EQ(test_cases[i].matches[j].experiment_relevance, |
1020 matches_[j].relevance); | 1020 matches_[j].relevance); |
1021 } | 1021 } |
1022 } | 1022 } |
1023 } | 1023 } |
OLD | NEW |