| OLD | NEW |
| 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/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "content/browser/frame_host/interstitial_page_impl.h" | 7 #include "content/browser/frame_host/interstitial_page_impl.h" |
| 8 #include "content/browser/frame_host/navigation_entry_impl.h" | 8 #include "content/browser/frame_host/navigation_entry_impl.h" |
| 9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 10 #include "content/browser/renderer_host/test_render_view_host.h" | 10 #include "content/browser/renderer_host/test_render_view_host.h" |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 InitNavigateParams(¶ms, 0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); | 307 InitNavigateParams(¶ms, 0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); |
| 308 | 308 |
| 309 LoadCommittedDetails details; | 309 LoadCommittedDetails details; |
| 310 cont.RendererDidNavigate(params, &details); | 310 cont.RendererDidNavigate(params, &details); |
| 311 | 311 |
| 312 contents()->UpdateTitle(rvh(), 0, ASCIIToUTF16(" Lots O' Whitespace\n"), | 312 contents()->UpdateTitle(rvh(), 0, ASCIIToUTF16(" Lots O' Whitespace\n"), |
| 313 base::i18n::LEFT_TO_RIGHT); | 313 base::i18n::LEFT_TO_RIGHT); |
| 314 EXPECT_EQ(ASCIIToUTF16("Lots O' Whitespace"), contents()->GetTitle()); | 314 EXPECT_EQ(ASCIIToUTF16("Lots O' Whitespace"), contents()->GetTitle()); |
| 315 } | 315 } |
| 316 | 316 |
| 317 TEST_F(WebContentsImplTest, DontUseTitleFromPendingEntry) { |
| 318 const GURL kGURL("chrome://blah"); |
| 319 controller().LoadURL( |
| 320 kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
| 321 EXPECT_EQ(string16(), contents()->GetTitle()); |
| 322 } |
| 323 |
| 324 TEST_F(WebContentsImplTest, UseTitleFromPendingEntryIfSet) { |
| 325 const GURL kGURL("chrome://blah"); |
| 326 const string16 title = ASCIIToUTF16("My Title"); |
| 327 controller().LoadURL( |
| 328 kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); |
| 329 |
| 330 NavigationEntry* entry = controller().GetVisibleEntry(); |
| 331 ASSERT_EQ(kGURL, entry->GetURL()); |
| 332 entry->SetTitle(title); |
| 333 |
| 334 EXPECT_EQ(title, contents()->GetTitle()); |
| 335 } |
| 336 |
| 317 // Test view source mode for a webui page. | 337 // Test view source mode for a webui page. |
| 318 TEST_F(WebContentsImplTest, NTPViewSource) { | 338 TEST_F(WebContentsImplTest, NTPViewSource) { |
| 319 NavigationControllerImpl& cont = | 339 NavigationControllerImpl& cont = |
| 320 static_cast<NavigationControllerImpl&>(controller()); | 340 static_cast<NavigationControllerImpl&>(controller()); |
| 321 const char kUrl[] = "view-source:chrome://blah"; | 341 const char kUrl[] = "view-source:chrome://blah"; |
| 322 const GURL kGURL(kUrl); | 342 const GURL kGURL(kUrl); |
| 323 | 343 |
| 324 process()->sink().ClearMessages(); | 344 process()->sink().ClearMessages(); |
| 325 | 345 |
| 326 cont.LoadURL( | 346 cont.LoadURL( |
| (...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2141 TEST_F(WebContentsImplTest, PendingContents) { | 2161 TEST_F(WebContentsImplTest, PendingContents) { |
| 2142 scoped_ptr<TestWebContents> other_contents( | 2162 scoped_ptr<TestWebContents> other_contents( |
| 2143 static_cast<TestWebContents*>(CreateTestWebContents())); | 2163 static_cast<TestWebContents*>(CreateTestWebContents())); |
| 2144 contents()->AddPendingContents(other_contents.get()); | 2164 contents()->AddPendingContents(other_contents.get()); |
| 2145 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); | 2165 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); |
| 2146 other_contents.reset(); | 2166 other_contents.reset(); |
| 2147 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id)); | 2167 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id)); |
| 2148 } | 2168 } |
| 2149 | 2169 |
| 2150 } // namespace content | 2170 } // namespace content |
| OLD | NEW |