| 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_quick_provider.h" | 5 #include "components/omnibox/browser/history_quick_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 DISALLOW_COPY_AND_ASSIGN(GetURLTask); | 176 DISALLOW_COPY_AND_ASSIGN(GetURLTask); |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 class FakeAutocompleteProviderClient : public MockAutocompleteProviderClient { | 179 class FakeAutocompleteProviderClient : public MockAutocompleteProviderClient { |
| 180 public: | 180 public: |
| 181 FakeAutocompleteProviderClient() : pool_owner_(3, "Background Pool") { | 181 FakeAutocompleteProviderClient() : pool_owner_(3, "Background Pool") { |
| 182 bookmark_model_ = bookmarks::TestBookmarkClient::CreateModel(); | 182 bookmark_model_ = bookmarks::TestBookmarkClient::CreateModel(); |
| 183 if (history_dir_.CreateUniqueTempDir()) { | 183 if (history_dir_.CreateUniqueTempDir()) { |
| 184 history_service_ = history::CreateHistoryService( | 184 history_service_ = history::CreateHistoryService( |
| 185 history_dir_.path(), GetAcceptLanguages(), true); | 185 history_dir_.path(), true); |
| 186 } | 186 } |
| 187 | 187 |
| 188 in_memory_url_index_.reset(new InMemoryURLIndex( | 188 in_memory_url_index_.reset(new InMemoryURLIndex( |
| 189 bookmark_model_.get(), history_service_.get(), nullptr, | 189 bookmark_model_.get(), history_service_.get(), nullptr, |
| 190 pool_owner_.pool().get(), history_dir_.path(), GetAcceptLanguages(), | 190 pool_owner_.pool().get(), history_dir_.path(), SchemeSet())); |
| 191 SchemeSet())); | |
| 192 in_memory_url_index_->Init(); | 191 in_memory_url_index_->Init(); |
| 193 } | 192 } |
| 194 | 193 |
| 195 const AutocompleteSchemeClassifier& GetSchemeClassifier() const override { | 194 const AutocompleteSchemeClassifier& GetSchemeClassifier() const override { |
| 196 return scheme_classifier_; | 195 return scheme_classifier_; |
| 197 } | 196 } |
| 198 | 197 |
| 199 const SearchTermsData& GetSearchTermsData() const override { | 198 const SearchTermsData& GetSearchTermsData() const override { |
| 200 return search_terms_data_; | 199 return search_terms_data_; |
| 201 } | 200 } |
| 202 | 201 |
| 203 history::HistoryService* GetHistoryService() override { | 202 history::HistoryService* GetHistoryService() override { |
| 204 return history_service_.get(); | 203 return history_service_.get(); |
| 205 } | 204 } |
| 206 | 205 |
| 207 bookmarks::BookmarkModel* GetBookmarkModel() override { | 206 bookmarks::BookmarkModel* GetBookmarkModel() override { |
| 208 return bookmark_model_.get(); | 207 return bookmark_model_.get(); |
| 209 } | 208 } |
| 210 | 209 |
| 211 InMemoryURLIndex* GetInMemoryURLIndex() override { | 210 InMemoryURLIndex* GetInMemoryURLIndex() override { |
| 212 return in_memory_url_index_.get(); | 211 return in_memory_url_index_.get(); |
| 213 } | 212 } |
| 214 | 213 |
| 215 std::string GetAcceptLanguages() const override { return "en,en-US,ko"; } | |
| 216 | |
| 217 void set_in_memory_url_index(scoped_ptr<InMemoryURLIndex> index) { | 214 void set_in_memory_url_index(scoped_ptr<InMemoryURLIndex> index) { |
| 218 in_memory_url_index_ = std::move(index); | 215 in_memory_url_index_ = std::move(index); |
| 219 } | 216 } |
| 220 | 217 |
| 221 private: | 218 private: |
| 222 base::SequencedWorkerPoolOwner pool_owner_; | 219 base::SequencedWorkerPoolOwner pool_owner_; |
| 223 base::ScopedTempDir history_dir_; | 220 base::ScopedTempDir history_dir_; |
| 224 scoped_ptr<bookmarks::BookmarkModel> bookmark_model_; | 221 scoped_ptr<bookmarks::BookmarkModel> bookmark_model_; |
| 225 TestSchemeClassifier scheme_classifier_; | 222 TestSchemeClassifier scheme_classifier_; |
| 226 SearchTermsData search_terms_data_; | 223 SearchTermsData search_terms_data_; |
| (...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 | 886 |
| 890 TEST_F(HQPOrderingTest, TEAMatch) { | 887 TEST_F(HQPOrderingTest, TEAMatch) { |
| 891 std::vector<std::string> expected_urls; | 888 std::vector<std::string> expected_urls; |
| 892 expected_urls.push_back("http://www.teamliquid.net/"); | 889 expected_urls.push_back("http://www.teamliquid.net/"); |
| 893 expected_urls.push_back("http://www.teamliquid.net/tlpd"); | 890 expected_urls.push_back("http://www.teamliquid.net/tlpd"); |
| 894 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); | 891 expected_urls.push_back("http://www.teamliquid.net/tlpd/korean/players"); |
| 895 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, | 892 RunTest(ASCIIToUTF16("tea"), false, expected_urls, true, |
| 896 ASCIIToUTF16("www.teamliquid.net"), | 893 ASCIIToUTF16("www.teamliquid.net"), |
| 897 ASCIIToUTF16("mliquid.net")); | 894 ASCIIToUTF16("mliquid.net")); |
| 898 } | 895 } |
| OLD | NEW |