| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |