summaryrefslogtreecommitdiffstats
path: root/chrome/browser/navigation_entry_unittest.cc
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 05:29:27 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-04 05:29:27 +0000
commit4c4d8d2b8aa8ae394d0f933700ddd9e682b141af (patch)
tree6e3e10e71c29bb9cc8d221d4de38d9dc603e32cd /chrome/browser/navigation_entry_unittest.cc
parent39d74d8b3c05faf98935927b68eaebb9a23a76a4 (diff)
downloadchromium_src-4c4d8d2b8aa8ae394d0f933700ddd9e682b141af.zip
chromium_src-4c4d8d2b8aa8ae394d0f933700ddd9e682b141af.tar.gz
chromium_src-4c4d8d2b8aa8ae394d0f933700ddd9e682b141af.tar.bz2
Convert NavigationEntry title to string16. TabContents::GetTitle no longer needs
to be virtual, either. This also changes how the display URL is computed. Instead of doing it preemptively, we now do so lazily. This allows us to do the URL formatting correctly using the elider so that we can do IDN and unescaping. I changed string_util's singleton functions. I was worried that other code might make a singleton of string, which would give you this same value as a non-const string. This would mean our empty strings might no longer be empty. Review URL: http://codereview.chromium.org/39022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/navigation_entry_unittest.cc')
-rw-r--r--chrome/browser/navigation_entry_unittest.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/chrome/browser/navigation_entry_unittest.cc b/chrome/browser/navigation_entry_unittest.cc
index a8c98d8..ebeeae8 100644
--- a/chrome/browser/navigation_entry_unittest.cc
+++ b/chrome/browser/navigation_entry_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/string16.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -17,7 +18,7 @@ class NavigationEntryTest : public testing::Test {
entry2_.reset(new NavigationEntry(TAB_CONTENTS_DOM_UI, instance_, 3,
GURL("test:url"),
GURL("from"),
- L"title",
+ ASCIIToUTF16("title"),
PageTransition::TYPED));
}
@@ -49,17 +50,18 @@ TEST_F(NavigationEntryTest, NavigationEntryURLs) {
EXPECT_EQ(GURL(), entry1_.get()->url());
EXPECT_EQ(GURL(), entry1_.get()->display_url());
- EXPECT_EQ(L"", entry1_.get()->GetTitleForDisplay());
+ EXPECT_TRUE(entry1_.get()->GetTitleForDisplay(NULL).empty());
// Setting URL affects display_url and GetTitleForDisplay
entry1_.get()->set_url(GURL("http://www.google.com"));
EXPECT_EQ(GURL("http://www.google.com"), entry1_.get()->url());
EXPECT_EQ(GURL("http://www.google.com/"), entry1_.get()->display_url());
- EXPECT_EQ(L"http://www.google.com/", entry1_.get()->GetTitleForDisplay());
+ EXPECT_EQ(ASCIIToUTF16("http://www.google.com/"),
+ entry1_.get()->GetTitleForDisplay(NULL));
// Title affects GetTitleForDisplay
- entry1_.get()->set_title(L"Google");
- EXPECT_EQ(L"Google", entry1_.get()->GetTitleForDisplay());
+ entry1_.get()->set_title(ASCIIToWide("Google"));
+ EXPECT_EQ(ASCIIToUTF16("Google"), entry1_.get()->GetTitleForDisplay(NULL));
// Setting display_url doesn't affect URL
entry2_.get()->set_display_url(GURL("display:url"));
@@ -68,7 +70,7 @@ TEST_F(NavigationEntryTest, NavigationEntryURLs) {
EXPECT_EQ(GURL("display:url"), entry2_.get()->display_url());
// Having a title set in constructor overrides display URL
- EXPECT_EQ(L"title", entry2_.get()->GetTitleForDisplay());
+ EXPECT_EQ(ASCIIToUTF16("title"), entry2_.get()->GetTitleForDisplay(NULL));
// User typed URL is independent of the others
EXPECT_EQ(GURL(), entry1_.get()->user_typed_url());
@@ -146,8 +148,8 @@ TEST_F(NavigationEntryTest, NavigationEntryAccessors) {
// Title
EXPECT_EQ(std::wstring(), entry1_.get()->title());
EXPECT_EQ(L"title", entry2_.get()->title());
- entry2_.get()->set_title(L"title2");
- EXPECT_EQ(L"title2", entry2_.get()->title());
+ entry2_.get()->set_title(ASCIIToUTF16("title2"));
+ EXPECT_EQ(ASCIIToUTF16("title2"), entry2_.get()->title());
// State
EXPECT_EQ(std::string(), entry1_.get()->content_state());