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

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

Issue 2939423003: URL Formatter: Add StripSubdomain method that preserves eTLD + 1. (Closed)
Patch Set: Return std::string instead of base::StringPiece (which makes no sense) Created 3 years, 6 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 | components/ssl_errors/error_classification.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search_engines/template_url_service_sync_unittest.cc
diff --git a/chrome/browser/search_engines/template_url_service_sync_unittest.cc b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
index cfa969130017cbf483c499c7d3128a80204d5d1e..7387bf13611ec95f94b560b972e99642279ddd64 100644
--- a/chrome/browser/search_engines/template_url_service_sync_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_sync_unittest.cc
@@ -1164,7 +1164,8 @@ TEST_F(TemplateURLServiceSyncTest, AutogeneratedKeywordMigrated) {
GURL google_url(model()->search_terms_data().GoogleBaseURLValue());
TemplateURL* key2 = model()->GetTemplateURLForHost(google_url.host());
ASSERT_FALSE(key2 == NULL);
- base::string16 google_keyword(url_formatter::StripWWWFromHost(google_url));
+ base::string16 google_keyword(UTF8ToUTF16(
+ url_formatter::StripSubdomains(google_url, url_formatter::kStripWWW)));
EXPECT_EQ(google_keyword, key2->keyword());
// We should also have gotten some corresponding UPDATEs pushed upstream.
@@ -1182,8 +1183,9 @@ TEST_F(TemplateURLServiceSyncTest, AutogeneratedKeywordMigrated) {
TEST_F(TemplateURLServiceSyncTest, AutogeneratedKeywordConflicts) {
// Sync brings in some autogenerated keywords, but the generated keywords we
// try to create conflict with ones in the model.
- base::string16 google_keyword(url_formatter::StripWWWFromHost(GURL(
- model()->search_terms_data().GoogleBaseURLValue())));
+ base::string16 google_keyword(UTF8ToUTF16(url_formatter::StripSubdomains(
+ GURL(model()->search_terms_data().GoogleBaseURLValue()),
+ url_formatter::kStripWWW)));
const std::string local_google_url =
"{google:baseURL}1/search?q={searchTerms}";
TemplateURL* google =
@@ -1256,8 +1258,9 @@ TEST_F(TemplateURLServiceSyncTest, TwoAutogeneratedKeywordsUsingGoogleBaseURL) {
PassProcessor(), CreateAndPassSyncErrorFactory());
// We should still have coalesced the updates to one each.
- base::string16 google_keyword(url_formatter::StripWWWFromHost(GURL(
- model()->search_terms_data().GoogleBaseURLValue())));
+ base::string16 google_keyword(UTF8ToUTF16(url_formatter::StripSubdomains(
+ GURL(model()->search_terms_data().GoogleBaseURLValue()),
+ url_formatter::kStripWWW)));
TemplateURL* keyword1 =
model()->GetTemplateURLForKeyword(google_keyword + ASCIIToUTF16("_"));
ASSERT_FALSE(keyword1 == NULL);
« no previous file with comments | « no previous file | components/ssl_errors/error_classification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698