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_quick_provider.h" | 5 #include "chrome/browser/autocomplete/history_quick_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 explicit SetShouldContain(const ACMatches& matched_urls); | 162 explicit SetShouldContain(const ACMatches& matched_urls); |
163 | 163 |
164 void operator()(const std::string& expected); | 164 void operator()(const std::string& expected); |
165 | 165 |
166 std::set<std::string> LeftOvers() const { return matches_; } | 166 std::set<std::string> LeftOvers() const { return matches_; } |
167 | 167 |
168 private: | 168 private: |
169 std::set<std::string> matches_; | 169 std::set<std::string> matches_; |
170 }; | 170 }; |
171 | 171 |
172 static KeyedService* CreateTemplateURLService( | 172 static scoped_ptr<KeyedService> CreateTemplateURLService( |
173 content::BrowserContext* context) { | 173 content::BrowserContext* context) { |
174 Profile* profile = static_cast<Profile*>(context); | 174 Profile* profile = static_cast<Profile*>(context); |
175 return new TemplateURLService( | 175 return make_scoped_ptr(new TemplateURLService( |
176 profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL, | 176 profile->GetPrefs(), make_scoped_ptr(new SearchTermsData), NULL, |
177 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( | 177 scoped_ptr<TemplateURLServiceClient>(new ChromeTemplateURLServiceClient( |
178 HistoryServiceFactory::GetForProfile( | 178 HistoryServiceFactory::GetForProfile( |
179 profile, ServiceAccessType::EXPLICIT_ACCESS))), | 179 profile, ServiceAccessType::EXPLICIT_ACCESS))), |
180 NULL, NULL, base::Closure()); | 180 NULL, NULL, base::Closure())); |
181 } | 181 } |
182 | 182 |
183 void SetUp() override; | 183 void SetUp() override; |
184 void TearDown() override; | 184 void TearDown() override; |
185 | 185 |
186 virtual void GetTestData(size_t* data_count, TestURLInfo** test_data); | 186 virtual void GetTestData(size_t* data_count, TestURLInfo** test_data); |
187 | 187 |
188 // Fills test data into the history system. | 188 // Fills test data into the history system. |
189 void FillData(); | 189 void FillData(); |
190 | 190 |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 | 829 |
830 TEST_F(HQPOrderingTest, TEAMatch) { | 830 TEST_F(HQPOrderingTest, TEAMatch) { |
831 std::vector<std::string> expected_urls; | 831 std::vector<std::string> expected_urls; |
832 expected_urls.push_back("http://www.teamliquid.net/"); | 832 expected_urls.push_back("http://www.teamliquid.net/"); |
833 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 833 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
834 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 834 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
835 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, | 835 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, |
836 ASCIIToUTF16("www.teamliquid.net"), | 836 ASCIIToUTF16("www.teamliquid.net"), |
837 ASCIIToUTF16("mliquid.net")); | 837 ASCIIToUTF16("mliquid.net")); |
838 } | 838 } |
OLD | NEW |