| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(base::MakeUnique<TemplateURLService>(nullptr, 0)); | 187 set_template_url_service(base::MakeUnique<TemplateURLService>(nullptr, 0)); |
| 188 if (history_dir_.CreateUniqueTempDir()) { | 188 if (history_dir_.CreateUniqueTempDir()) { |
| 189 history_service_ = history::CreateHistoryService(history_dir_.path(), | 189 history_service_ = |
| 190 true); | 190 history::CreateHistoryService(history_dir_.GetPath(), true); |
| 191 } | 191 } |
| 192 | 192 |
| 193 db_thread_.Start(); | 193 db_thread_.Start(); |
| 194 shortcuts_backend_ = new ShortcutsBackend( | 194 shortcuts_backend_ = new ShortcutsBackend( |
| 195 GetTemplateURLService(), base::MakeUnique<SearchTermsData>(), | 195 GetTemplateURLService(), base::MakeUnique<SearchTermsData>(), |
| 196 history_service_.get(), db_thread_.task_runner(), base::FilePath(), | 196 history_service_.get(), db_thread_.task_runner(), base::FilePath(), |
| 197 true); | 197 true); |
| 198 shortcuts_backend_->Init(); | 198 shortcuts_backend_->Init(); |
| 199 } | 199 } |
| 200 | 200 |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 } | 744 } |
| 745 | 745 |
| 746 TEST_F(ShortcutsProviderTest, DoesNotProvideOnFocus) { | 746 TEST_F(ShortcutsProviderTest, DoesNotProvideOnFocus) { |
| 747 AutocompleteInput input(ASCIIToUTF16("about:o"), base::string16::npos, | 747 AutocompleteInput input(ASCIIToUTF16("about:o"), base::string16::npos, |
| 748 std::string(), GURL(), | 748 std::string(), GURL(), |
| 749 metrics::OmniboxEventProto::INVALID_SPEC, false, | 749 metrics::OmniboxEventProto::INVALID_SPEC, false, |
| 750 false, true, true, true, TestSchemeClassifier()); | 750 false, true, true, true, TestSchemeClassifier()); |
| 751 provider_->Start(input, false); | 751 provider_->Start(input, false); |
| 752 EXPECT_TRUE(provider_->matches().empty()); | 752 EXPECT_TRUE(provider_->matches().empty()); |
| 753 } | 753 } |
| OLD | NEW |