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

Unified Diff: chrome/browser/policy/policy_browsertest.cc

Issue 2214393003: Change network error titles to just the hostname (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Browser test fix Created 4 years, 4 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/policy/policy_browsertest.cc
diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc
index 21795486c87fde30f851c01554cabbe20eaa81aa..5a36b122169d462bc152ce17b07830d1cde4e300 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -371,9 +371,13 @@ void CheckCanOpenURL(Browser* browser, const char* spec) {
content::WebContents* contents =
browser->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(url, contents->GetURL());
- base::string16 spec16 = base::UTF8ToUTF16(url.spec());
- base::string16 title =
- l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_BLOCKED, spec16);
+
+ base::string16 title;
+ if (url.has_host())
+ title = base::UTF8ToUTF16(url.host());
+ else
+ // Local file paths show the full URL.
+ title = base::UTF8ToUTF16(url.spec());
mmenke 2016/08/08 14:23:49 Use braces on if / else bodies, when one of them t
EXPECT_NE(title, contents->GetTitle());
}
@@ -384,9 +388,13 @@ void CheckURLIsBlocked(Browser* browser, const char* spec) {
content::WebContents* contents =
browser->tab_strip_model()->GetActiveWebContents();
EXPECT_EQ(url, contents->GetURL());
- base::string16 spec16 = base::UTF8ToUTF16(url.spec());
- base::string16 title =
- l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_BLOCKED, spec16);
+
+ base::string16 title;
+ if (url.has_host())
+ title = base::UTF8ToUTF16(url.host());
+ else
+ // Local file paths show the full URL.
+ title = base::UTF8ToUTF16(url.spec());
mmenke 2016/08/08 14:23:49 Use braces
EXPECT_EQ(title, contents->GetTitle());
// Verify that the expected error page is being displayed.
« no previous file with comments | « chrome/browser/content_settings/content_settings_browsertest.cc ('k') | components/error_page/common/localized_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698