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

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: Add missing braces 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..bdf9459abb8ac6ec080ad0950856ecc4c4c4178d 100644
--- a/chrome/browser/policy/policy_browsertest.cc
+++ b/chrome/browser/policy/policy_browsertest.cc
@@ -371,9 +371,14 @@ 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;
Thiemo Nagel 2016/08/09 18:24:58 To make this more understandable, could you maybe
+ if (url.has_host()) {
+ title = base::UTF8ToUTF16(url.host());
+ } else {
+ // Local file paths show the full URL.
Thiemo Nagel 2016/08/09 18:24:57 Nit: Please drop duplicate blank.
+ title = base::UTF8ToUTF16(url.spec());
+ }
EXPECT_NE(title, contents->GetTitle());
}
@@ -384,9 +389,14 @@ 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;
Thiemo Nagel 2016/08/09 18:24:57 Same as above.
+ if (url.has_host()) {
+ title = base::UTF8ToUTF16(url.host());
+ } else {
+ // Local file paths show the full URL.
Thiemo Nagel 2016/08/09 18:24:58 Nit: Please drop duplicate blank.
+ title = base::UTF8ToUTF16(url.spec());
+ }
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