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