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

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

Issue 118443008: Support cross-process navigations in a single subframe RenderFrameHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanup Created 7 years 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/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/site_instance_impl.h" 10 #include "content/browser/site_instance_impl.h"
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 } // namespace 295 } // namespace
296 296
297 // Test to make sure that title updates get stripped of whitespace. 297 // Test to make sure that title updates get stripped of whitespace.
298 TEST_F(WebContentsImplTest, UpdateTitle) { 298 TEST_F(WebContentsImplTest, UpdateTitle) {
299 NavigationControllerImpl& cont = 299 NavigationControllerImpl& cont =
300 static_cast<NavigationControllerImpl&>(controller()); 300 static_cast<NavigationControllerImpl&>(controller());
301 ViewHostMsg_FrameNavigate_Params params; 301 ViewHostMsg_FrameNavigate_Params params;
302 InitNavigateParams(&params, 0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED); 302 InitNavigateParams(&params, 0, GURL(kAboutBlankURL), PAGE_TRANSITION_TYPED);
303 303
304 LoadCommittedDetails details; 304 LoadCommittedDetails details;
305 cont.RendererDidNavigate(params, &details); 305 cont.RendererDidNavigate(test_rvh(), params, &details);
306 306
307 contents()->UpdateTitle(rvh(), 0, ASCIIToUTF16(" Lots O' Whitespace\n"), 307 contents()->UpdateTitle(rvh(), 0, ASCIIToUTF16(" Lots O' Whitespace\n"),
308 base::i18n::LEFT_TO_RIGHT); 308 base::i18n::LEFT_TO_RIGHT);
309 EXPECT_EQ(ASCIIToUTF16("Lots O' Whitespace"), contents()->GetTitle()); 309 EXPECT_EQ(ASCIIToUTF16("Lots O' Whitespace"), contents()->GetTitle());
310 } 310 }
311 311
312 TEST_F(WebContentsImplTest, DontUseTitleFromPendingEntry) { 312 TEST_F(WebContentsImplTest, DontUseTitleFromPendingEntry) {
313 const GURL kGURL("chrome://blah"); 313 const GURL kGURL("chrome://blah");
314 controller().LoadURL( 314 controller().LoadURL(
315 kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); 315 kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string());
(...skipping 25 matching lines...) Expand all
341 cont.LoadURL( 341 cont.LoadURL(
342 kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string()); 342 kGURL, Referrer(), PAGE_TRANSITION_TYPED, std::string());
343 rvh()->GetDelegate()->RenderViewCreated(rvh()); 343 rvh()->GetDelegate()->RenderViewCreated(rvh());
344 // Did we get the expected message? 344 // Did we get the expected message?
345 EXPECT_TRUE(process()->sink().GetFirstMessageMatching( 345 EXPECT_TRUE(process()->sink().GetFirstMessageMatching(
346 ViewMsg_EnableViewSourceMode::ID)); 346 ViewMsg_EnableViewSourceMode::ID));
347 347
348 ViewHostMsg_FrameNavigate_Params params; 348 ViewHostMsg_FrameNavigate_Params params;
349 InitNavigateParams(&params, 0, kGURL, PAGE_TRANSITION_TYPED); 349 InitNavigateParams(&params, 0, kGURL, PAGE_TRANSITION_TYPED);
350 LoadCommittedDetails details; 350 LoadCommittedDetails details;
351 cont.RendererDidNavigate(params, &details); 351 cont.RendererDidNavigate(test_rvh(), params, &details);
352 // Also check title and url. 352 // Also check title and url.
353 EXPECT_EQ(ASCIIToUTF16(kUrl), contents()->GetTitle()); 353 EXPECT_EQ(ASCIIToUTF16(kUrl), contents()->GetTitle());
354 } 354 }
355 355
356 // Test to ensure UpdateMaxPageID is working properly. 356 // Test to ensure UpdateMaxPageID is working properly.
357 TEST_F(WebContentsImplTest, UpdateMaxPageID) { 357 TEST_F(WebContentsImplTest, UpdateMaxPageID) {
358 SiteInstance* instance1 = contents()->GetSiteInstance(); 358 SiteInstance* instance1 = contents()->GetSiteInstance();
359 scoped_refptr<SiteInstance> instance2(SiteInstance::Create(NULL)); 359 scoped_refptr<SiteInstance> instance2(SiteInstance::Create(NULL));
360 360
361 // Starts at -1. 361 // Starts at -1.
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
2162 TEST_F(WebContentsImplTest, PendingContents) { 2162 TEST_F(WebContentsImplTest, PendingContents) {
2163 scoped_ptr<TestWebContents> other_contents( 2163 scoped_ptr<TestWebContents> other_contents(
2164 static_cast<TestWebContents*>(CreateTestWebContents())); 2164 static_cast<TestWebContents*>(CreateTestWebContents()));
2165 contents()->AddPendingContents(other_contents.get()); 2165 contents()->AddPendingContents(other_contents.get());
2166 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); 2166 int route_id = other_contents->GetRenderViewHost()->GetRoutingID();
2167 other_contents.reset(); 2167 other_contents.reset();
2168 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id)); 2168 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id));
2169 } 2169 }
2170 2170
2171 } // namespace content 2171 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698