| 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/shortcuts_provider.h" | 5 #include "components/omnibox/browser/shortcuts_provider.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 "Trailing2 - Space in Shortcut", "0,1", | 177 "Trailing2 - Space in Shortcut", "0,1", |
| 178 "Trailing2 - Space in Shortcut", "0,1", ui::PAGE_TRANSITION_TYPED, | 178 "Trailing2 - Space in Shortcut", "0,1", ui::PAGE_TRANSITION_TYPED, |
| 179 AutocompleteMatchType::HISTORY_URL, "", 1, 100 }, | 179 AutocompleteMatchType::HISTORY_URL, "", 1, 100 }, |
| 180 }; | 180 }; |
| 181 | 181 |
| 182 class FakeAutocompleteProviderClient | 182 class FakeAutocompleteProviderClient |
| 183 : public testing::NiceMock<MockAutocompleteProviderClient> { | 183 : public testing::NiceMock<MockAutocompleteProviderClient> { |
| 184 public: | 184 public: |
| 185 FakeAutocompleteProviderClient() | 185 FakeAutocompleteProviderClient() |
| 186 : db_thread_("Test DB thread"), pool_owner_(3, "Background Pool") { | 186 : db_thread_("Test DB thread"), pool_owner_(3, "Background Pool") { |
| 187 set_template_url_service( | 187 set_template_url_service(base::MakeUnique<TemplateURLService>(nullptr, 0)); |
| 188 base::WrapUnique(new TemplateURLService(nullptr, 0))); | |
| 189 if (history_dir_.CreateUniqueTempDir()) { | 188 if (history_dir_.CreateUniqueTempDir()) { |
| 190 history_service_ = history::CreateHistoryService(history_dir_.path(), | 189 history_service_ = history::CreateHistoryService(history_dir_.path(), |
| 191 true); | 190 true); |
| 192 } | 191 } |
| 193 | 192 |
| 194 db_thread_.Start(); | 193 db_thread_.Start(); |
| 195 shortcuts_backend_ = new ShortcutsBackend( | 194 shortcuts_backend_ = new ShortcutsBackend( |
| 196 GetTemplateURLService(), base::WrapUnique(new SearchTermsData()), | 195 GetTemplateURLService(), base::MakeUnique<SearchTermsData>(), |
| 197 history_service_.get(), db_thread_.task_runner(), base::FilePath(), | 196 history_service_.get(), db_thread_.task_runner(), base::FilePath(), |
| 198 true); | 197 true); |
| 199 shortcuts_backend_->Init(); | 198 shortcuts_backend_->Init(); |
| 200 } | 199 } |
| 201 | 200 |
| 202 ~FakeAutocompleteProviderClient() override { db_thread_.Stop(); } | 201 ~FakeAutocompleteProviderClient() override { db_thread_.Stop(); } |
| 203 | 202 |
| 204 history::HistoryService* GetHistoryService() override { | 203 history::HistoryService* GetHistoryService() override { |
| 205 return history_service_.get(); | 204 return history_service_.get(); |
| 206 } | 205 } |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 } | 744 } |
| 746 | 745 |
| 747 TEST_F(ShortcutsProviderTest, DoesNotProvideOnFocus) { | 746 TEST_F(ShortcutsProviderTest, DoesNotProvideOnFocus) { |
| 748 AutocompleteInput input(ASCIIToUTF16("about:o"), base::string16::npos, | 747 AutocompleteInput input(ASCIIToUTF16("about:o"), base::string16::npos, |
| 749 std::string(), GURL(), | 748 std::string(), GURL(), |
| 750 metrics::OmniboxEventProto::INVALID_SPEC, false, | 749 metrics::OmniboxEventProto::INVALID_SPEC, false, |
| 751 false, true, true, true, TestSchemeClassifier()); | 750 false, true, true, true, TestSchemeClassifier()); |
| 752 provider_->Start(input, false); | 751 provider_->Start(input, false); |
| 753 EXPECT_TRUE(provider_->matches().empty()); | 752 EXPECT_TRUE(provider_->matches().empty()); |
| 754 } | 753 } |
| OLD | NEW |