Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4548)

Unified Diff: chrome/browser/autocomplete/history_url_provider_unittest.cc

Issue 672773003: Include a URL what-you-typed option when the default search provider is not available and the input… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix style nits, convert virtual to override in unit test Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..e0b4f2608879b6170d966c510912bd4cdd7ee5e1 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"
@@ -183,10 +184,10 @@ class HistoryURLProviderTest : public testing::Test,
}
// testing::Test
- virtual void SetUp() {
+ void SetUp() override {
ASSERT_TRUE(SetUpImpl(false));
}
- virtual void TearDown();
+ void TearDown() override;
// Does the real setup.
bool SetUpImpl(bool no_db) WARN_UNUSED_RESULT;
@@ -226,11 +227,24 @@ class HistoryURLProviderTest : public testing::Test,
class HistoryURLProviderTestNoDB : public HistoryURLProviderTest {
protected:
- virtual void SetUp() {
+ void SetUp() override {
ASSERT_TRUE(SetUpImpl(true));
}
};
+class HistoryURLProviderTestNoSearchProvider : public HistoryURLProviderTest {
+ protected:
+ void SetUp() override {
+ DefaultSearchManager::SetFallbackSearchEnginesDisabledForTesting(true);
+ HistoryURLProviderTest::SetUp();
+ }
+
+ void TearDown() override {
+ 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.
+
+ 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);
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698