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

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: Add unit tests, make suggested style and comment changes 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
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);

Powered by Google App Engine
This is Rietveld 408576698