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

Side by Side Diff: content/browser/web_contents/navigation_entry_impl_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/time.h" 7 #include "base/time.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "content/browser/site_instance_impl.h" 9 #include "content/browser/site_instance_impl.h"
10 #include "content/browser/web_contents/navigation_entry_impl.h" 10 #include "content/browser/web_contents/navigation_entry_impl.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 // Test URL accessors 56 // Test URL accessors
57 TEST_F(NavigationEntryTest, NavigationEntryURLs) { 57 TEST_F(NavigationEntryTest, NavigationEntryURLs) {
58 // Start with no virtual_url (even if a url is set) 58 // Start with no virtual_url (even if a url is set)
59 EXPECT_FALSE(entry1_->has_virtual_url()); 59 EXPECT_FALSE(entry1_->has_virtual_url());
60 EXPECT_FALSE(entry2_->has_virtual_url()); 60 EXPECT_FALSE(entry2_->has_virtual_url());
61 61
62 EXPECT_EQ(GURL(), entry1_->GetURL()); 62 EXPECT_EQ(GURL(), entry1_->GetURL());
63 EXPECT_EQ(GURL(), entry1_->GetVirtualURL()); 63 EXPECT_EQ(GURL(), entry1_->GetVirtualURL());
64 EXPECT_TRUE(entry1_->GetTitleForDisplay("").empty()); 64 EXPECT_TRUE(entry1_->GetTitleForDisplay(std::string()).empty());
65 65
66 // Setting URL affects virtual_url and GetTitleForDisplay 66 // Setting URL affects virtual_url and GetTitleForDisplay
67 entry1_->SetURL(GURL("http://www.google.com")); 67 entry1_->SetURL(GURL("http://www.google.com"));
68 EXPECT_EQ(GURL("http://www.google.com"), entry1_->GetURL()); 68 EXPECT_EQ(GURL("http://www.google.com"), entry1_->GetURL());
69 EXPECT_EQ(GURL("http://www.google.com"), entry1_->GetVirtualURL()); 69 EXPECT_EQ(GURL("http://www.google.com"), entry1_->GetVirtualURL());
70 EXPECT_EQ(ASCIIToUTF16("www.google.com"), 70 EXPECT_EQ(ASCIIToUTF16("www.google.com"),
71 entry1_->GetTitleForDisplay("")); 71 entry1_->GetTitleForDisplay(std::string()));
72 72
73 // file:/// URLs should only show the filename. 73 // file:/// URLs should only show the filename.
74 entry1_->SetURL(GURL("file:///foo/bar baz.txt")); 74 entry1_->SetURL(GURL("file:///foo/bar baz.txt"));
75 EXPECT_EQ(ASCIIToUTF16("bar baz.txt"), 75 EXPECT_EQ(ASCIIToUTF16("bar baz.txt"),
76 entry1_->GetTitleForDisplay("")); 76 entry1_->GetTitleForDisplay(std::string()));
77 77
78 // Title affects GetTitleForDisplay 78 // Title affects GetTitleForDisplay
79 entry1_->SetTitle(ASCIIToUTF16("Google")); 79 entry1_->SetTitle(ASCIIToUTF16("Google"));
80 EXPECT_EQ(ASCIIToUTF16("Google"), entry1_->GetTitleForDisplay("")); 80 EXPECT_EQ(ASCIIToUTF16("Google"), entry1_->GetTitleForDisplay(std::string()));
81 81
82 // Setting virtual_url doesn't affect URL 82 // Setting virtual_url doesn't affect URL
83 entry2_->SetVirtualURL(GURL("display:url")); 83 entry2_->SetVirtualURL(GURL("display:url"));
84 EXPECT_TRUE(entry2_->has_virtual_url()); 84 EXPECT_TRUE(entry2_->has_virtual_url());
85 EXPECT_EQ(GURL("test:url"), entry2_->GetURL()); 85 EXPECT_EQ(GURL("test:url"), entry2_->GetURL());
86 EXPECT_EQ(GURL("display:url"), entry2_->GetVirtualURL()); 86 EXPECT_EQ(GURL("display:url"), entry2_->GetVirtualURL());
87 87
88 // Having a title set in constructor overrides virtual URL 88 // Having a title set in constructor overrides virtual URL
89 EXPECT_EQ(ASCIIToUTF16("title"), entry2_->GetTitleForDisplay("")); 89 EXPECT_EQ(ASCIIToUTF16("title"), entry2_->GetTitleForDisplay(std::string()));
90 90
91 // User typed URL is independent of the others 91 // User typed URL is independent of the others
92 EXPECT_EQ(GURL(), entry1_->GetUserTypedURL()); 92 EXPECT_EQ(GURL(), entry1_->GetUserTypedURL());
93 EXPECT_EQ(GURL(), entry2_->GetUserTypedURL()); 93 EXPECT_EQ(GURL(), entry2_->GetUserTypedURL());
94 entry2_->set_user_typed_url(GURL("typedurl")); 94 entry2_->set_user_typed_url(GURL("typedurl"));
95 EXPECT_EQ(GURL("typedurl"), entry2_->GetUserTypedURL()); 95 EXPECT_EQ(GURL("typedurl"), entry2_->GetUserTypedURL());
96 } 96 }
97 97
98 // Test Favicon inner class construction. 98 // Test Favicon inner class construction.
99 TEST_F(NavigationEntryTest, NavigationEntryFavicons) { 99 TEST_F(NavigationEntryTest, NavigationEntryFavicons) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // Content in |output| is not modified if data is not present at the key. 232 // Content in |output| is not modified if data is not present at the key.
233 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output)); 233 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output));
234 EXPECT_EQ(test_data, output); 234 EXPECT_EQ(test_data, output);
235 // Using an empty string shows that the data is not present in the map. 235 // Using an empty string shows that the data is not present in the map.
236 string16 output2; 236 string16 output2;
237 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output2)); 237 EXPECT_FALSE(entry1_->GetExtraData("search_terms", &output2));
238 EXPECT_EQ(ASCIIToUTF16(""), output2); 238 EXPECT_EQ(ASCIIToUTF16(""), output2);
239 } 239 }
240 240
241 } // namespace content 241 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/tracing/tracing_ui.cc ('k') | content/browser/webui/web_ui_data_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698