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

Unified Diff: chrome/browser/search_engines/template_url_fetcher_unittest.cc

Issue 2902043004: Omnibox - Open Search - Handle Lack of Short Name Smartly (Closed)
Patch Set: pkasting comments Created 3 years, 7 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 | « no previous file | chrome/test/data/simple_open_search_no_name.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url_fetcher_unittest.cc
diff --git a/chrome/browser/search_engines/template_url_fetcher_unittest.cc b/chrome/browser/search_engines/template_url_fetcher_unittest.cc
index 35ca95ce437b161a47f1dd6fb2f614aa6788a6bd..b6119bbc4c8daa841ae8734beb84d7aceac7512b 100644
--- a/chrome/browser/search_engines/template_url_fetcher_unittest.cc
+++ b/chrome/browser/search_engines/template_url_fetcher_unittest.cc
@@ -182,6 +182,25 @@ TEST_F(TemplateURLFetcherTest, BasicAutodetectedTest) {
EXPECT_TRUE(t_url->safe_for_autoreplace());
}
+// This test is similar to the BasicAutodetectedTest except the xml file
+// provided doesn't include a short name for the search engine. We should
+// fall back to the hostname.
+TEST_F(TemplateURLFetcherTest, InvalidShortName) {
+ base::string16 keyword(ASCIIToUTF16("test"));
+
+ test_util()->ChangeModelToLoadState();
+ ASSERT_FALSE(test_util()->model()->GetTemplateURLForKeyword(keyword));
+
+ std::string osdd_file_name("simple_open_search_no_name.xml");
+ StartDownload(keyword, osdd_file_name, true);
+ WaitForDownloadToFinish();
+
+ const TemplateURL* t_url =
+ test_util()->model()->GetTemplateURLForKeyword(keyword);
+ ASSERT_TRUE(t_url);
+ EXPECT_EQ(ASCIIToUTF16("example.com"), t_url->short_name());
+}
+
TEST_F(TemplateURLFetcherTest, DuplicatesThrownAway) {
base::string16 keyword(ASCIIToUTF16("test"));
« no previous file with comments | « no previous file | chrome/test/data/simple_open_search_no_name.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698