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

Side by Side Diff: ios/web/navigation/navigation_item_impl_unittest.mm

Issue 2876053002: Fixed NavigationItemImpl::GetDisplayTitleForURL for 'file://' URL. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « ios/web/navigation/navigation_item_impl.mm ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ios/web/navigation/navigation_item_impl.h" 5 #import "ios/web/navigation/navigation_item_impl.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #import "base/mac/scoped_nsobject.h" 10 #import "base/mac/scoped_nsobject.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 GURL original_url = item_->GetURL(); 141 GURL original_url = item_->GetURL();
142 EXPECT_EQ(original_url, item_->GetVirtualURL()); 142 EXPECT_EQ(original_url, item_->GetVirtualURL());
143 // Set the virtual URL and check that the correct value is reported and that 143 // Set the virtual URL and check that the correct value is reported and that
144 // GetURL() still reports the original URL. 144 // GetURL() still reports the original URL.
145 GURL new_virtual_url = GURL("http://new_url.test"); 145 GURL new_virtual_url = GURL("http://new_url.test");
146 item_->SetVirtualURL(new_virtual_url); 146 item_->SetVirtualURL(new_virtual_url);
147 EXPECT_EQ(new_virtual_url, item_->GetVirtualURL()); 147 EXPECT_EQ(new_virtual_url, item_->GetVirtualURL());
148 EXPECT_EQ(original_url, item_->GetURL()); 148 EXPECT_EQ(original_url, item_->GetURL());
149 } 149 }
150 150
151 // Tests NavigationItemImpl::GetDisplayTitleForURL method.
152 TEST_F(NavigationItemTest, GetDisplayTitleForURL) {
153 base::string16 title;
154
155 title = NavigationItemImpl::GetDisplayTitleForURL(GURL("http://foo.org/"));
156 EXPECT_EQ("foo.org", base::UTF16ToUTF8(title));
157
158 title = NavigationItemImpl::GetDisplayTitleForURL(GURL("file://foo.org/"));
159 EXPECT_EQ("file://foo.org/", base::UTF16ToUTF8(title));
160
161 title = NavigationItemImpl::GetDisplayTitleForURL(GURL("file://foo/1.gz"));
162 EXPECT_EQ("1.gz", base::UTF16ToUTF8(title));
163 }
164
151 } // namespace 165 } // namespace
152 } // namespace web 166 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/navigation/navigation_item_impl.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698