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

Side by Side Diff: content/browser/tab_contents/navigation_entry_unittest.cc

Issue 6591127: fix display of filenames in file:/// URLs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: whitespace Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/tab_contents/navigation_entry.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/string16.h" 5 #include "base/string16.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "content/browser/site_instance.h" 8 #include "content/browser/site_instance.h"
9 #include "content/browser/tab_contents/navigation_entry.h" 9 #include "content/browser/tab_contents/navigation_entry.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 EXPECT_EQ(GURL(), entry1_.get()->virtual_url()); 55 EXPECT_EQ(GURL(), entry1_.get()->virtual_url());
56 EXPECT_TRUE(entry1_.get()->GetTitleForDisplay("").empty()); 56 EXPECT_TRUE(entry1_.get()->GetTitleForDisplay("").empty());
57 57
58 // Setting URL affects virtual_url and GetTitleForDisplay 58 // Setting URL affects virtual_url and GetTitleForDisplay
59 entry1_.get()->set_url(GURL("http://www.google.com")); 59 entry1_.get()->set_url(GURL("http://www.google.com"));
60 EXPECT_EQ(GURL("http://www.google.com"), entry1_.get()->url()); 60 EXPECT_EQ(GURL("http://www.google.com"), entry1_.get()->url());
61 EXPECT_EQ(GURL("http://www.google.com"), entry1_.get()->virtual_url()); 61 EXPECT_EQ(GURL("http://www.google.com"), entry1_.get()->virtual_url());
62 EXPECT_EQ(ASCIIToUTF16("www.google.com"), 62 EXPECT_EQ(ASCIIToUTF16("www.google.com"),
63 entry1_.get()->GetTitleForDisplay("")); 63 entry1_.get()->GetTitleForDisplay(""));
64 64
65 // file:/// URLs should only show the filename.
66 entry1_.get()->set_url(GURL("file:///foo/bar baz.txt"));
67 EXPECT_EQ(ASCIIToUTF16("bar baz.txt"),
68 entry1_.get()->GetTitleForDisplay(""));
69
65 // Title affects GetTitleForDisplay 70 // Title affects GetTitleForDisplay
66 entry1_.get()->set_title(ASCIIToUTF16("Google")); 71 entry1_.get()->set_title(ASCIIToUTF16("Google"));
67 EXPECT_EQ(ASCIIToUTF16("Google"), entry1_.get()->GetTitleForDisplay("")); 72 EXPECT_EQ(ASCIIToUTF16("Google"), entry1_.get()->GetTitleForDisplay(""));
68 73
69 // Setting virtual_url doesn't affect URL 74 // Setting virtual_url doesn't affect URL
70 entry2_.get()->set_virtual_url(GURL("display:url")); 75 entry2_.get()->set_virtual_url(GURL("display:url"));
71 EXPECT_TRUE(entry2_.get()->has_virtual_url()); 76 EXPECT_TRUE(entry2_.get()->has_virtual_url());
72 EXPECT_EQ(GURL("test:url"), entry2_.get()->url()); 77 EXPECT_EQ(GURL("test:url"), entry2_.get()->url());
73 EXPECT_EQ(GURL("display:url"), entry2_.get()->virtual_url()); 78 EXPECT_EQ(GURL("display:url"), entry2_.get()->virtual_url());
74 79
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 EXPECT_FALSE(entry2_.get()->has_post_data()); 179 EXPECT_FALSE(entry2_.get()->has_post_data());
175 entry2_.get()->set_has_post_data(true); 180 entry2_.get()->set_has_post_data(true);
176 EXPECT_TRUE(entry2_.get()->has_post_data()); 181 EXPECT_TRUE(entry2_.get()->has_post_data());
177 182
178 // Restored 183 // Restored
179 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type()); 184 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry1_->restore_type());
180 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type()); 185 EXPECT_EQ(NavigationEntry::RESTORE_NONE, entry2_->restore_type());
181 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION); 186 entry2_->set_restore_type(NavigationEntry::RESTORE_LAST_SESSION);
182 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type()); 187 EXPECT_EQ(NavigationEntry::RESTORE_LAST_SESSION, entry2_->restore_type());
183 } 188 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/navigation_entry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698