Chromium Code Reviews| Index: chrome/browser/autocomplete/history_url_provider_unittest.cc |
| diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc |
| index cb8ddccc0fbe5ca9660db53347d5ae055c010cd8..693947a7d85a2240fc62f2c504fd9b75b7c4f422 100644 |
| --- a/chrome/browser/autocomplete/history_url_provider_unittest.cc |
| +++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc |
| @@ -28,6 +28,7 @@ |
| #include "components/omnibox/autocomplete_provider.h" |
| #include "components/omnibox/autocomplete_provider_listener.h" |
| #include "components/omnibox/autocomplete_result.h" |
| +#include "components/search_engines/default_search_manager.h" |
| #include "components/search_engines/search_terms_data.h" |
| #include "components/search_engines/template_url.h" |
| #include "components/search_engines/template_url_service.h" |
| @@ -231,6 +232,19 @@ class HistoryURLProviderTestNoDB : public HistoryURLProviderTest { |
| } |
| }; |
| +class HistoryURLProviderTestNoSearchProvider : public HistoryURLProviderTest { |
| + protected: |
| + virtual void SetUp() { |
|
Peter Kasting
2014/10/24 22:02:13
Nit: virtual -> override (2 places)
I realize the
|
| + DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting(true); |
| + HistoryURLProviderTest::SetUp(); |
| + } |
| + |
| + virtual void TearDown() { |
| + HistoryURLProviderTest::TearDown(); |
| + DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting(false); |
| + } |
| +}; |
| + |
| void HistoryURLProviderTest::OnProviderUpdate(bool updated_matches) { |
| if (autocomplete_->done()) |
| base::MessageLoop::current()->Quit(); |
| @@ -480,6 +494,26 @@ TEST_F(HistoryURLProviderTest, CullRedirects) { |
| arraysize(expected_results)); |
| } |
| +TEST_F(HistoryURLProviderTestNoSearchProvider, WhatYouTypedNoSearchProvider) { |
| + // When no search provider is available, make sure we provide WYT matches |
| + // for text that could be a URL |
|
Peter Kasting
2014/10/24 22:02:13
Nit: Trailing period.
|
| + |
| + const UrlAndLegalDefault results_1[] = { |
| + { "http://wytmatch/", true } |
| + }; |
| + RunTest(ASCIIToUTF16("wytmatch"), std::string(), false, results_1, |
| + arraysize(results_1)); |
| + |
| + RunTest(ASCIIToUTF16("wytmatch foo bar"), std::string(), false, NULL, 0); |
| + RunTest(ASCIIToUTF16("wytmatch+foo+bar"), std::string(), false, NULL, 0); |
| + |
| + const UrlAndLegalDefault results_2[] = { |
| + { "http://wytmatch+foo+bar.com/", true } |
| + }; |
| + RunTest(ASCIIToUTF16("wytmatch+foo+bar.com"), std::string(), false, |
| + results_2, arraysize(results_2)); |
| +} |
| + |
| TEST_F(HistoryURLProviderTest, WhatYouTyped) { |
| // Make sure we suggest a What You Typed match at the right times. |
| RunTest(ASCIIToUTF16("wytmatch"), std::string(), false, NULL, 0); |