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

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: Remove unused title string 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..a39b85bac316b0e1362d0bfcd246800b978c984a 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 filename as the title.
+ title = base::UTF8ToUTF16(url.ExtractFileName());
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 filename as the title.
+ title = base::UTF8ToUTF16(url.ExtractFileName());
EXPECT_EQ(title, contents->GetTitle());
// Verify that the expected error page is being displayed.
@@ -2553,7 +2561,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_FileURLBlacklist) {
PathService::Get(chrome::DIR_TEST_DATA, &test_path);
const std::string base_path = "file://" + test_path.AsUTF8Unsafe() +"/";
const std::string folder_path = base_path + "apptest/";
- const std::string file_path1 = base_path + "title1.html";
+ const std::string file_path1 = base_path + "title2.html";
const std::string file_path2 = folder_path + "basic.html";
CheckCanOpenURL(browser(), file_path1.c_str());

Powered by Google App Engine
This is Rietveld 408576698