diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-03 20:27:20 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-03 20:27:20 +0000 |
commit | 3ce9568bb8605aeada8c2be069ec425366b3b9b0 (patch) | |
tree | 89e69506dbe0842af5941dd0e6ad02053346cbe7 /content/browser/tab_contents/navigation_entry_unittest.cc | |
parent | 9861ae9e58cee87e1780ba00e2887a5f855a8ddf (diff) | |
download | chromium_src-3ce9568bb8605aeada8c2be069ec425366b3b9b0.zip chromium_src-3ce9568bb8605aeada8c2be069ec425366b3b9b0.tar.gz chromium_src-3ce9568bb8605aeada8c2be069ec425366b3b9b0.tar.bz2 |
fix display of filenames in file:/// URLs
The code attempted to shorten file:/// URLs to just the filename
when displayed as the title of a page. But that appears to have
regressed sometime in the past. This shortening is consistent with
how we display the title of images (which are like "foo.png (123x456)".)
Chrome does a poor job of displaying longer titles (most of the
tab title ends up being "file:///C:/" anyway).
In any case, using a FilePath to get the filename from a URL may not
have even worked on Windows, where the path separator is a backslash.
It appears Glen wrote the original code, Brett may be the one to have
regressed it in a refactor, and I probably broke it worse in a FilePath
refactor.
BUG=69467
TEST=load a text file via a file: URL; tab title is just the file name
Review URL: http://codereview.chromium.org/6591127
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76792 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/tab_contents/navigation_entry_unittest.cc')
-rw-r--r-- | content/browser/tab_contents/navigation_entry_unittest.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/content/browser/tab_contents/navigation_entry_unittest.cc b/content/browser/tab_contents/navigation_entry_unittest.cc index 4b5bfb0..9d5edc83 100644 --- a/content/browser/tab_contents/navigation_entry_unittest.cc +++ b/content/browser/tab_contents/navigation_entry_unittest.cc @@ -62,6 +62,11 @@ TEST_F(NavigationEntryTest, NavigationEntryURLs) { EXPECT_EQ(ASCIIToUTF16("www.google.com"), entry1_.get()->GetTitleForDisplay("")); + // file:/// URLs should only show the filename. + entry1_.get()->set_url(GURL("file:///foo/bar baz.txt")); + EXPECT_EQ(ASCIIToUTF16("bar baz.txt"), + entry1_.get()->GetTitleForDisplay("")); + // Title affects GetTitleForDisplay entry1_.get()->set_title(ASCIIToUTF16("Google")); EXPECT_EQ(ASCIIToUTF16("Google"), entry1_.get()->GetTitleForDisplay("")); |