| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "content/browser/frame_host/cross_site_transferring_request.h" | 10 #include "content/browser/frame_host/cross_site_transferring_request.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 void set_should_create_webui(bool should_create_webui) { | 255 void set_should_create_webui(bool should_create_webui) { |
| 256 factory_.set_should_create_webui(should_create_webui); | 256 factory_.set_should_create_webui(should_create_webui); |
| 257 } | 257 } |
| 258 | 258 |
| 259 void NavigateActiveAndCommit(const GURL& url) { | 259 void NavigateActiveAndCommit(const GURL& url) { |
| 260 // Note: we navigate the active RenderFrameHost because previous navigations | 260 // Note: we navigate the active RenderFrameHost because previous navigations |
| 261 // won't have committed yet, so NavigateAndCommit does the wrong thing | 261 // won't have committed yet, so NavigateAndCommit does the wrong thing |
| 262 // for us. | 262 // for us. |
| 263 controller().LoadURL( | 263 controller().LoadURL( |
| 264 url, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 264 url, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 265 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 265 | 266 |
| 266 // Simulate the BeforeUnload_ACK that is received from the current renderer | 267 // Simulate the BeforeUnload_ACK that is received from the current renderer |
| 267 // for a cross-site navigation. | 268 // for a cross-site navigation. |
| 268 // PlzNavigate: it is necessary to call PrepareForCommit before getting the | 269 // PlzNavigate: it is necessary to call PrepareForCommit before getting the |
| 269 // main and the pending frame because when we are trying to navigate to a | 270 // main and the pending frame because when we are trying to navigate to a |
| 270 // WebUI from a new tab, a RenderFrameHost is created to display it that is | 271 // WebUI from a new tab, a RenderFrameHost is created to display it that is |
| 271 // committed immediately (since it is a new tab). Therefore the main frame | 272 // committed immediately (since it is a new tab). Therefore the main frame |
| 272 // is replaced without a pending frame being created, and we don't get the | 273 // is replaced without a pending frame being created, and we don't get the |
| 273 // right values for the RFH to navigate: we try to use the old one that has | 274 // right values for the RFH to navigate: we try to use the old one that has |
| 274 // been deleted in the meantime. | 275 // been deleted in the meantime. |
| 275 contents()->GetMainFrame()->PrepareForCommit(); | 276 contents()->GetMainFrame()->PrepareForCommit(); |
| 276 | 277 |
| 277 TestRenderFrameHost* old_rfh = contents()->GetMainFrame(); | 278 TestRenderFrameHost* old_rfh = contents()->GetMainFrame(); |
| 278 TestRenderFrameHost* active_rfh = contents()->GetPendingMainFrame() | 279 TestRenderFrameHost* active_rfh = contents()->GetPendingMainFrame() |
| 279 ? contents()->GetPendingMainFrame() | 280 ? contents()->GetPendingMainFrame() |
| 280 : old_rfh; | 281 : old_rfh; |
| 281 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, old_rfh->rfh_state()); | 282 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, old_rfh->rfh_state()); |
| 282 | 283 |
| 283 // Commit the navigation with a new page ID. | 284 // Commit the navigation with a new page ID. |
| 284 int32 max_page_id = contents()->GetMaxPageIDForSiteInstance( | 285 int32 max_page_id = contents()->GetMaxPageIDForSiteInstance( |
| 285 active_rfh->GetSiteInstance()); | 286 active_rfh->GetSiteInstance()); |
| 286 | 287 |
| 287 // Use an observer to avoid accessing a deleted renderer later on when the | 288 // Use an observer to avoid accessing a deleted renderer later on when the |
| 288 // state is being checked. | 289 // state is being checked. |
| 289 RenderFrameHostDeletedObserver rfh_observer(old_rfh); | 290 RenderFrameHostDeletedObserver rfh_observer(old_rfh); |
| 290 RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); | 291 RenderViewHostDeletedObserver rvh_observer(old_rfh->GetRenderViewHost()); |
| 291 active_rfh->SendNavigate(max_page_id + 1, url); | 292 active_rfh->SendNavigate(max_page_id + 1, entry_id, true, url); |
| 292 | 293 |
| 293 // Make sure that we start to run the unload handler at the time of commit. | 294 // Make sure that we start to run the unload handler at the time of commit. |
| 294 bool expecting_rfh_shutdown = false; | 295 bool expecting_rfh_shutdown = false; |
| 295 if (old_rfh != active_rfh && !rfh_observer.deleted()) { | 296 if (old_rfh != active_rfh && !rfh_observer.deleted()) { |
| 296 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, | 297 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, |
| 297 old_rfh->rfh_state()); | 298 old_rfh->rfh_state()); |
| 298 if (!old_rfh->GetSiteInstance()->active_frame_count()) { | 299 if (!old_rfh->GetSiteInstance()->active_frame_count()) { |
| 299 expecting_rfh_shutdown = true; | 300 expecting_rfh_shutdown = true; |
| 300 EXPECT_TRUE( | 301 EXPECT_TRUE( |
| 301 old_rfh->frame_tree_node()->render_manager()->IsPendingDeletion( | 302 old_rfh->frame_tree_node()->render_manager()->IsPendingDeletion( |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 const GURL kChromeURL("chrome://foo"); | 345 const GURL kChromeURL("chrome://foo"); |
| 345 const GURL kDestUrl("http://www.google.com/"); | 346 const GURL kDestUrl("http://www.google.com/"); |
| 346 | 347 |
| 347 // Navigate our first tab to a chrome url and then to the destination. | 348 // Navigate our first tab to a chrome url and then to the destination. |
| 348 NavigateActiveAndCommit(kChromeURL); | 349 NavigateActiveAndCommit(kChromeURL); |
| 349 TestRenderFrameHost* ntp_rfh = contents()->GetMainFrame(); | 350 TestRenderFrameHost* ntp_rfh = contents()->GetMainFrame(); |
| 350 | 351 |
| 351 // Navigate to a cross-site URL. | 352 // Navigate to a cross-site URL. |
| 352 contents()->GetController().LoadURL( | 353 contents()->GetController().LoadURL( |
| 353 kDestUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 354 kDestUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 355 int entry_id = contents()->GetController().GetPendingEntry()->GetUniqueID(); |
| 354 contents()->GetMainFrame()->PrepareForCommit(); | 356 contents()->GetMainFrame()->PrepareForCommit(); |
| 355 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); | 357 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
| 356 | 358 |
| 357 // Manually increase the number of active frames in the | 359 // Manually increase the number of active frames in the |
| 358 // SiteInstance that ntp_rfh belongs to, to prevent it from being | 360 // SiteInstance that ntp_rfh belongs to, to prevent it from being |
| 359 // destroyed when it gets swapped out. | 361 // destroyed when it gets swapped out. |
| 360 ntp_rfh->GetSiteInstance()->increment_active_frame_count(); | 362 ntp_rfh->GetSiteInstance()->increment_active_frame_count(); |
| 361 | 363 |
| 362 TestRenderFrameHost* dest_rfh = contents()->GetPendingMainFrame(); | 364 TestRenderFrameHost* dest_rfh = contents()->GetPendingMainFrame(); |
| 363 CHECK(dest_rfh); | 365 CHECK(dest_rfh); |
| 364 EXPECT_NE(ntp_rfh, dest_rfh); | 366 EXPECT_NE(ntp_rfh, dest_rfh); |
| 365 | 367 |
| 366 // BeforeUnload finishes. | 368 // BeforeUnload finishes. |
| 367 ntp_rfh->SendBeforeUnloadACK(true); | 369 ntp_rfh->SendBeforeUnloadACK(true); |
| 368 | 370 |
| 369 dest_rfh->SendNavigate(101, kDestUrl); | 371 dest_rfh->SendNavigate(101, entry_id, true, kDestUrl); |
| 370 ntp_rfh->OnSwappedOut(); | 372 ntp_rfh->OnSwappedOut(); |
| 371 | 373 |
| 372 EXPECT_TRUE(ntp_rfh->is_swapped_out()); | 374 EXPECT_TRUE(ntp_rfh->is_swapped_out()); |
| 373 return ntp_rfh; | 375 return ntp_rfh; |
| 374 } | 376 } |
| 375 | 377 |
| 376 // Returns the RenderFrameHost that should be used in the navigation to | 378 // Returns the RenderFrameHost that should be used in the navigation to |
| 377 // |entry|. | 379 // |entry|. |
| 378 RenderFrameHostImpl* NavigateToEntry( | 380 RenderFrameHostImpl* NavigateToEntry( |
| 379 RenderFrameHostManager* manager, | 381 RenderFrameHostManager* manager, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 430 |
| 429 // Make a second tab. | 431 // Make a second tab. |
| 430 scoped_ptr<TestWebContents> contents2( | 432 scoped_ptr<TestWebContents> contents2( |
| 431 TestWebContents::Create(browser_context(), NULL)); | 433 TestWebContents::Create(browser_context(), NULL)); |
| 432 | 434 |
| 433 // Load the two URLs in the second tab. Note that the first navigation creates | 435 // Load the two URLs in the second tab. Note that the first navigation creates |
| 434 // a RFH that's not pending (since there is no cross-site transition), so | 436 // a RFH that's not pending (since there is no cross-site transition), so |
| 435 // we use the committed one. | 437 // we use the committed one. |
| 436 contents2->GetController().LoadURL( | 438 contents2->GetController().LoadURL( |
| 437 kChromeUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 439 kChromeUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 440 int entry_id = contents2->GetController().GetPendingEntry()->GetUniqueID(); |
| 438 contents2->GetMainFrame()->PrepareForCommit(); | 441 contents2->GetMainFrame()->PrepareForCommit(); |
| 439 TestRenderFrameHost* ntp_rfh2 = contents2->GetMainFrame(); | 442 TestRenderFrameHost* ntp_rfh2 = contents2->GetMainFrame(); |
| 440 EXPECT_FALSE(contents2->CrossProcessNavigationPending()); | 443 EXPECT_FALSE(contents2->CrossProcessNavigationPending()); |
| 441 ntp_rfh2->SendNavigate(100, kChromeUrl); | 444 ntp_rfh2->SendNavigate(100, entry_id, true, kChromeUrl); |
| 442 | 445 |
| 443 // The second one is the opposite, creating a cross-site transition and | 446 // The second one is the opposite, creating a cross-site transition and |
| 444 // requiring a beforeunload ack. | 447 // requiring a beforeunload ack. |
| 445 contents2->GetController().LoadURL( | 448 contents2->GetController().LoadURL( |
| 446 kDestUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 449 kDestUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 450 entry_id = contents2->GetController().GetPendingEntry()->GetUniqueID(); |
| 447 contents2->GetMainFrame()->PrepareForCommit(); | 451 contents2->GetMainFrame()->PrepareForCommit(); |
| 448 EXPECT_TRUE(contents2->CrossProcessNavigationPending()); | 452 EXPECT_TRUE(contents2->CrossProcessNavigationPending()); |
| 449 TestRenderFrameHost* dest_rfh2 = contents2->GetPendingMainFrame(); | 453 TestRenderFrameHost* dest_rfh2 = contents2->GetPendingMainFrame(); |
| 450 ASSERT_TRUE(dest_rfh2); | 454 ASSERT_TRUE(dest_rfh2); |
| 451 | 455 |
| 452 dest_rfh2->SendNavigate(101, kDestUrl); | 456 dest_rfh2->SendNavigate(101, entry_id, true, kDestUrl); |
| 453 | 457 |
| 454 // The two RFH's should be different in every way. | 458 // The two RFH's should be different in every way. |
| 455 EXPECT_NE(contents()->GetMainFrame()->GetProcess(), dest_rfh2->GetProcess()); | 459 EXPECT_NE(contents()->GetMainFrame()->GetProcess(), dest_rfh2->GetProcess()); |
| 456 EXPECT_NE(contents()->GetMainFrame()->GetSiteInstance(), | 460 EXPECT_NE(contents()->GetMainFrame()->GetSiteInstance(), |
| 457 dest_rfh2->GetSiteInstance()); | 461 dest_rfh2->GetSiteInstance()); |
| 458 EXPECT_FALSE(dest_rfh2->GetSiteInstance()->IsRelatedSiteInstance( | 462 EXPECT_FALSE(dest_rfh2->GetSiteInstance()->IsRelatedSiteInstance( |
| 459 contents()->GetMainFrame()->GetSiteInstance())); | 463 contents()->GetMainFrame()->GetSiteInstance())); |
| 460 | 464 |
| 461 // Navigate both to the new tab page, and verify that they share a | 465 // Navigate both to the new tab page, and verify that they share a |
| 462 // RenderProcessHost (not a SiteInstance). | 466 // RenderProcessHost (not a SiteInstance). |
| 463 NavigateActiveAndCommit(kChromeUrl); | 467 NavigateActiveAndCommit(kChromeUrl); |
| 464 EXPECT_FALSE(contents()->GetPendingMainFrame()); | 468 EXPECT_FALSE(contents()->GetPendingMainFrame()); |
| 465 | 469 |
| 466 contents2->GetController().LoadURL( | 470 contents2->GetController().LoadURL( |
| 467 kChromeUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 471 kChromeUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 472 entry_id = contents2->GetController().GetPendingEntry()->GetUniqueID(); |
| 468 contents2->GetMainFrame()->PrepareForCommit(); | 473 contents2->GetMainFrame()->PrepareForCommit(); |
| 469 contents2->GetPendingMainFrame()->SendNavigate(102, kChromeUrl); | 474 contents2->GetPendingMainFrame()->SendNavigate(102, entry_id, true, |
| 475 kChromeUrl); |
| 470 | 476 |
| 471 EXPECT_NE(contents()->GetMainFrame()->GetSiteInstance(), | 477 EXPECT_NE(contents()->GetMainFrame()->GetSiteInstance(), |
| 472 contents2->GetMainFrame()->GetSiteInstance()); | 478 contents2->GetMainFrame()->GetSiteInstance()); |
| 473 EXPECT_EQ(contents()->GetMainFrame()->GetSiteInstance()->GetProcess(), | 479 EXPECT_EQ(contents()->GetMainFrame()->GetSiteInstance()->GetProcess(), |
| 474 contents2->GetMainFrame()->GetSiteInstance()->GetProcess()); | 480 contents2->GetMainFrame()->GetSiteInstance()->GetProcess()); |
| 475 } | 481 } |
| 476 | 482 |
| 477 // Ensure that the browser ignores most IPC messages that arrive from a | 483 // Ensure that the browser ignores most IPC messages that arrive from a |
| 478 // RenderViewHost that has been swapped out. We do not want to take | 484 // RenderViewHost that has been swapped out. We do not want to take |
| 479 // action on requests from a non-active renderer. The main exception is | 485 // action on requests from a non-active renderer. The main exception is |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 EXPECT_TRUE(observer.favicon_received()); | 596 EXPECT_TRUE(observer.favicon_received()); |
| 591 } | 597 } |
| 592 | 598 |
| 593 // Create one more frame in the same SiteInstance where |rfh1| exists so that | 599 // Create one more frame in the same SiteInstance where |rfh1| exists so that |
| 594 // it doesn't get deleted on navigation to another site. | 600 // it doesn't get deleted on navigation to another site. |
| 595 rfh1->GetSiteInstance()->increment_active_frame_count(); | 601 rfh1->GetSiteInstance()->increment_active_frame_count(); |
| 596 | 602 |
| 597 // Navigate to a cross-site URL and commit the new page. | 603 // Navigate to a cross-site URL and commit the new page. |
| 598 controller().LoadURL( | 604 controller().LoadURL( |
| 599 kDestUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 605 kDestUrl, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 606 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 600 contents()->GetMainFrame()->PrepareForCommit(); | 607 contents()->GetMainFrame()->PrepareForCommit(); |
| 601 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); | 608 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); |
| 602 contents()->TestDidNavigate(rfh2, 1, kDestUrl, ui::PAGE_TRANSITION_TYPED); | 609 contents()->TestDidNavigate(rfh2, 1, entry_id, true, kDestUrl, |
| 610 ui::PAGE_TRANSITION_TYPED); |
| 603 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); | 611 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); |
| 604 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); | 612 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); |
| 605 | 613 |
| 606 // The new RVH should be able to update its favicons. | 614 // The new RVH should be able to update its favicons. |
| 607 { | 615 { |
| 608 PluginFaviconMessageObserver observer(contents()); | 616 PluginFaviconMessageObserver observer(contents()); |
| 609 EXPECT_TRUE(rfh2->GetRenderViewHost()->OnMessageReceived( | 617 EXPECT_TRUE(rfh2->GetRenderViewHost()->OnMessageReceived( |
| 610 ViewHostMsg_UpdateFaviconURL(rfh2->GetRenderViewHost()->GetRoutingID(), | 618 ViewHostMsg_UpdateFaviconURL(rfh2->GetRenderViewHost()->GetRoutingID(), |
| 611 icons))); | 619 icons))); |
| 612 EXPECT_TRUE(observer.favicon_received()); | 620 EXPECT_TRUE(observer.favicon_received()); |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 // the second navigation. We have to avoid this in order to exercise the | 854 // the second navigation. We have to avoid this in order to exercise the |
| 847 // target code path. | 855 // target code path. |
| 848 NavigateActiveAndCommit(kChromeUrl); | 856 NavigateActiveAndCommit(kChromeUrl); |
| 849 | 857 |
| 850 // Navigate. Note that "view source" URLs are implemented by putting the RFH | 858 // Navigate. Note that "view source" URLs are implemented by putting the RFH |
| 851 // into a view-source mode and then navigating to the inner URL, so that's why | 859 // into a view-source mode and then navigating to the inner URL, so that's why |
| 852 // the bare URL is what's committed and returned by the last committed entry's | 860 // the bare URL is what's committed and returned by the last committed entry's |
| 853 // GetURL() call. | 861 // GetURL() call. |
| 854 controller().LoadURL( | 862 controller().LoadURL( |
| 855 kViewSourceUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 863 kViewSourceUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 864 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 856 | 865 |
| 857 // Simulate response from RenderFrame for DispatchBeforeUnload. | 866 // Simulate response from RenderFrame for DispatchBeforeUnload. |
| 858 contents()->GetMainFrame()->PrepareForCommit(); | 867 contents()->GetMainFrame()->PrepareForCommit(); |
| 859 ASSERT_TRUE(contents()->GetPendingMainFrame()) | 868 ASSERT_TRUE(contents()->GetPendingMainFrame()) |
| 860 << "Expected new pending RenderFrameHost to be created."; | 869 << "Expected new pending RenderFrameHost to be created."; |
| 861 RenderFrameHost* last_rfh = contents()->GetPendingMainFrame(); | 870 RenderFrameHost* last_rfh = contents()->GetPendingMainFrame(); |
| 862 int32 new_id = | 871 int32 new_id = |
| 863 contents()->GetMaxPageIDForSiteInstance(last_rfh->GetSiteInstance()) + 1; | 872 contents()->GetMaxPageIDForSiteInstance(last_rfh->GetSiteInstance()) + 1; |
| 864 contents()->GetPendingMainFrame()->SendNavigate(new_id, kUrl); | 873 contents()->GetPendingMainFrame()->SendNavigate(new_id, entry_id, true, kUrl); |
| 865 | 874 |
| 866 EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); | 875 EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); |
| 867 NavigationEntry* last_committed = controller().GetLastCommittedEntry(); | 876 NavigationEntry* last_committed = controller().GetLastCommittedEntry(); |
| 868 ASSERT_NE(nullptr, last_committed); | 877 ASSERT_NE(nullptr, last_committed); |
| 869 EXPECT_EQ(kUrl, last_committed->GetURL()); | 878 EXPECT_EQ(kUrl, last_committed->GetURL()); |
| 870 EXPECT_EQ(kViewSourceUrl, last_committed->GetVirtualURL()); | 879 EXPECT_EQ(kViewSourceUrl, last_committed->GetVirtualURL()); |
| 871 EXPECT_FALSE(controller().GetPendingEntry()); | 880 EXPECT_FALSE(controller().GetPendingEntry()); |
| 872 // Because we're using TestWebContents and TestRenderViewHost in this | 881 // Because we're using TestWebContents and TestRenderViewHost in this |
| 873 // unittest, no one calls WebContentsImpl::RenderViewCreated(). So, we see no | 882 // unittest, no one calls WebContentsImpl::RenderViewCreated(). So, we see no |
| 874 // EnableViewSourceMode message, here. | 883 // EnableViewSourceMode message, here. |
| 875 | 884 |
| 876 // Clear queued messages before load. | 885 // Clear queued messages before load. |
| 877 process()->sink().ClearMessages(); | 886 process()->sink().ClearMessages(); |
| 878 | 887 |
| 879 // Navigate, again. | 888 // Navigate, again. |
| 880 controller().LoadURL( | 889 controller().LoadURL( |
| 881 kViewSourceUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 890 kViewSourceUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 891 entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 882 contents()->GetMainFrame()->PrepareForCommit(); | 892 contents()->GetMainFrame()->PrepareForCommit(); |
| 883 | 893 |
| 884 // The same RenderViewHost should be reused. | 894 // The same RenderViewHost should be reused. |
| 885 EXPECT_FALSE(contents()->GetPendingMainFrame()); | 895 EXPECT_FALSE(contents()->GetPendingMainFrame()); |
| 886 EXPECT_EQ(last_rfh, contents()->GetMainFrame()); | 896 EXPECT_EQ(last_rfh, contents()->GetMainFrame()); |
| 887 | 897 |
| 888 // The renderer sends a commit. | 898 // The renderer sends a commit. |
| 889 contents()->GetMainFrame()->SendNavigate(new_id, kUrl); | 899 contents()->GetMainFrame()->SendNavigate(new_id, entry_id, false, kUrl); |
| 890 EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); | 900 EXPECT_EQ(1, controller().GetLastCommittedEntryIndex()); |
| 891 EXPECT_FALSE(controller().GetPendingEntry()); | 901 EXPECT_FALSE(controller().GetPendingEntry()); |
| 892 | 902 |
| 893 // New message should be sent out to make sure to enter view-source mode. | 903 // New message should be sent out to make sure to enter view-source mode. |
| 894 EXPECT_TRUE(process()->sink().GetUniqueMessageMatching( | 904 EXPECT_TRUE(process()->sink().GetUniqueMessageMatching( |
| 895 ViewMsg_EnableViewSourceMode::ID)); | 905 ViewMsg_EnableViewSourceMode::ID)); |
| 896 } | 906 } |
| 897 | 907 |
| 898 // Tests the Init function by checking the initial RenderViewHost. | 908 // Tests the Init function by checking the initial RenderViewHost. |
| 899 TEST_F(RenderFrameHostManagerTest, Init) { | 909 TEST_F(RenderFrameHostManagerTest, Init) { |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 contents()->GetMainFrame()->PrepareForCommit(); | 1190 contents()->GetMainFrame()->PrepareForCommit(); |
| 1181 // We should have a new pending RFH. | 1191 // We should have a new pending RFH. |
| 1182 // Note that in this case, the navigation has not committed, so evil_rfh will | 1192 // Note that in this case, the navigation has not committed, so evil_rfh will |
| 1183 // not be deleted yet. | 1193 // not be deleted yet. |
| 1184 EXPECT_NE(evil_rfh, contents()->GetPendingMainFrame()); | 1194 EXPECT_NE(evil_rfh, contents()->GetPendingMainFrame()); |
| 1185 EXPECT_NE(evil_rfh->GetRenderViewHost(), | 1195 EXPECT_NE(evil_rfh->GetRenderViewHost(), |
| 1186 contents()->GetPendingMainFrame()->GetRenderViewHost()); | 1196 contents()->GetPendingMainFrame()->GetRenderViewHost()); |
| 1187 | 1197 |
| 1188 // Before that RFH has committed, the evil page reloads itself. | 1198 // Before that RFH has committed, the evil page reloads itself. |
| 1189 FrameHostMsg_DidCommitProvisionalLoad_Params params; | 1199 FrameHostMsg_DidCommitProvisionalLoad_Params params; |
| 1190 params.page_id = 1; | 1200 params.page_id = 0; |
| 1201 params.nav_entry_id = 0; |
| 1202 params.did_create_new_entry = false; |
| 1191 params.url = kUrl2; | 1203 params.url = kUrl2; |
| 1192 params.transition = ui::PAGE_TRANSITION_CLIENT_REDIRECT; | 1204 params.transition = ui::PAGE_TRANSITION_CLIENT_REDIRECT; |
| 1193 params.should_update_history = false; | 1205 params.should_update_history = false; |
| 1194 params.gesture = NavigationGestureAuto; | 1206 params.gesture = NavigationGestureAuto; |
| 1195 params.was_within_same_page = false; | 1207 params.was_within_same_page = false; |
| 1196 params.is_post = false; | 1208 params.is_post = false; |
| 1197 params.page_state = PageState::CreateFromURL(kUrl2); | 1209 params.page_state = PageState::CreateFromURL(kUrl2); |
| 1198 | 1210 |
| 1199 contents()->GetFrameTree()->root()->navigator()->DidNavigate(evil_rfh, | 1211 contents()->GetFrameTree()->root()->navigator()->DidNavigate(evil_rfh, |
| 1200 params); | 1212 params); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 // Now go back, but suppose the SwapOut_ACK isn't received. This shouldn't | 1272 // Now go back, but suppose the SwapOut_ACK isn't received. This shouldn't |
| 1261 // happen, but we have seen it when going back quickly across many entries | 1273 // happen, but we have seen it when going back quickly across many entries |
| 1262 // (http://crbug.com/93427). | 1274 // (http://crbug.com/93427). |
| 1263 contents()->GetController().GoBack(); | 1275 contents()->GetController().GoBack(); |
| 1264 EXPECT_TRUE(rfh2->IsWaitingForBeforeUnloadACK()); | 1276 EXPECT_TRUE(rfh2->IsWaitingForBeforeUnloadACK()); |
| 1265 contents()->GetMainFrame()->PrepareForCommit(); | 1277 contents()->GetMainFrame()->PrepareForCommit(); |
| 1266 EXPECT_FALSE(rfh2->IsWaitingForBeforeUnloadACK()); | 1278 EXPECT_FALSE(rfh2->IsWaitingForBeforeUnloadACK()); |
| 1267 | 1279 |
| 1268 // The back navigation commits. | 1280 // The back navigation commits. |
| 1269 const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); | 1281 const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); |
| 1270 rfh1->SendNavigate(entry1->GetPageID(), entry1->GetURL()); | 1282 rfh1->SendNavigate(entry1->GetPageID(), entry1->GetUniqueID(), false, |
| 1283 entry1->GetURL()); |
| 1271 EXPECT_TRUE(rfh2->IsWaitingForUnloadACK()); | 1284 EXPECT_TRUE(rfh2->IsWaitingForUnloadACK()); |
| 1272 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh2->rfh_state()); | 1285 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh2->rfh_state()); |
| 1273 | 1286 |
| 1274 // We should be able to navigate forward. | 1287 // We should be able to navigate forward. |
| 1275 contents()->GetController().GoForward(); | 1288 contents()->GetController().GoForward(); |
| 1276 contents()->GetMainFrame()->PrepareForCommit(); | 1289 contents()->GetMainFrame()->PrepareForCommit(); |
| 1277 const NavigationEntry* entry2 = contents()->GetController().GetPendingEntry(); | 1290 const NavigationEntry* entry2 = contents()->GetController().GetPendingEntry(); |
| 1278 rfh2->SendNavigate(entry2->GetPageID(), entry2->GetURL()); | 1291 rfh2->SendNavigate(entry2->GetPageID(), entry2->GetUniqueID(), false, |
| 1292 entry2->GetURL()); |
| 1279 EXPECT_EQ(rfh2, main_test_rfh()); | 1293 EXPECT_EQ(rfh2, main_test_rfh()); |
| 1280 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); | 1294 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); |
| 1281 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); | 1295 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); |
| 1282 rfh1->OnSwappedOut(); | 1296 rfh1->OnSwappedOut(); |
| 1283 EXPECT_TRUE(rfh1->is_swapped_out()); | 1297 EXPECT_TRUE(rfh1->is_swapped_out()); |
| 1284 EXPECT_EQ(RenderFrameHostImpl::STATE_SWAPPED_OUT, rfh1->rfh_state()); | 1298 EXPECT_EQ(RenderFrameHostImpl::STATE_SWAPPED_OUT, rfh1->rfh_state()); |
| 1285 } | 1299 } |
| 1286 | 1300 |
| 1287 // Test that we create swapped out RFHs for the opener chain when navigating an | 1301 // Test that we create swapped out RFHs for the opener chain when navigating an |
| 1288 // opened tab cross-process. This allows us to support certain cross-process | 1302 // opened tab cross-process. This allows us to support certain cross-process |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1447 contents()->GetMainFrame()->PrepareForCommit(); | 1461 contents()->GetMainFrame()->PrepareForCommit(); |
| 1448 | 1462 |
| 1449 // Disown the opener from rfh2. | 1463 // Disown the opener from rfh2. |
| 1450 rfh2->DidDisownOpener(); | 1464 rfh2->DidDisownOpener(); |
| 1451 | 1465 |
| 1452 // Ensure the opener is cleared. | 1466 // Ensure the opener is cleared. |
| 1453 EXPECT_FALSE(contents()->HasOpener()); | 1467 EXPECT_FALSE(contents()->HasOpener()); |
| 1454 | 1468 |
| 1455 // The back navigation commits. | 1469 // The back navigation commits. |
| 1456 const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); | 1470 const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); |
| 1457 rfh1->SendNavigate(entry1->GetPageID(), entry1->GetURL()); | 1471 rfh1->SendNavigate(entry1->GetPageID(), entry1->GetUniqueID(), false, |
| 1472 entry1->GetURL()); |
| 1458 | 1473 |
| 1459 // Ensure the opener is still cleared. | 1474 // Ensure the opener is still cleared. |
| 1460 EXPECT_FALSE(contents()->HasOpener()); | 1475 EXPECT_FALSE(contents()->HasOpener()); |
| 1461 } | 1476 } |
| 1462 | 1477 |
| 1463 // Test that a page can disown the opener just after a cross-process navigation | 1478 // Test that a page can disown the opener just after a cross-process navigation |
| 1464 // commits. | 1479 // commits. |
| 1465 TEST_F(RenderFrameHostManagerTest, DisownOpenerAfterNavigation) { | 1480 TEST_F(RenderFrameHostManagerTest, DisownOpenerAfterNavigation) { |
| 1466 const GURL kUrl1("http://www.google.com/"); | 1481 const GURL kUrl1("http://www.google.com/"); |
| 1467 const GURL kUrl2("http://www.chromium.org/"); | 1482 const GURL kUrl2("http://www.chromium.org/"); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1480 // BrowsingInstance). | 1495 // BrowsingInstance). |
| 1481 contents()->NavigateAndCommit(kUrl2); | 1496 contents()->NavigateAndCommit(kUrl2); |
| 1482 TestRenderFrameHost* rfh2 = main_test_rfh(); | 1497 TestRenderFrameHost* rfh2 = main_test_rfh(); |
| 1483 EXPECT_NE(rfh1->GetSiteInstance(), rfh2->GetSiteInstance()); | 1498 EXPECT_NE(rfh1->GetSiteInstance(), rfh2->GetSiteInstance()); |
| 1484 | 1499 |
| 1485 // Commit a back navigation before the DidDisownOpener message arrives. | 1500 // Commit a back navigation before the DidDisownOpener message arrives. |
| 1486 // rfh1 will be kept alive because of the opener tab. | 1501 // rfh1 will be kept alive because of the opener tab. |
| 1487 contents()->GetController().GoBack(); | 1502 contents()->GetController().GoBack(); |
| 1488 contents()->GetMainFrame()->PrepareForCommit(); | 1503 contents()->GetMainFrame()->PrepareForCommit(); |
| 1489 const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); | 1504 const NavigationEntry* entry1 = contents()->GetController().GetPendingEntry(); |
| 1490 rfh1->SendNavigate(entry1->GetPageID(), entry1->GetURL()); | 1505 rfh1->SendNavigate(entry1->GetPageID(), entry1->GetUniqueID(), false, |
| 1506 entry1->GetURL()); |
| 1491 | 1507 |
| 1492 // Disown the opener from rfh2. | 1508 // Disown the opener from rfh2. |
| 1493 rfh2->DidDisownOpener(); | 1509 rfh2->DidDisownOpener(); |
| 1494 EXPECT_FALSE(contents()->HasOpener()); | 1510 EXPECT_FALSE(contents()->HasOpener()); |
| 1495 } | 1511 } |
| 1496 | 1512 |
| 1497 // Test that we clean up swapped out RenderViewHosts when a process hosting | 1513 // Test that we clean up swapped out RenderViewHosts when a process hosting |
| 1498 // those associated RenderViews crashes. http://crbug.com/258993 | 1514 // those associated RenderViews crashes. http://crbug.com/258993 |
| 1499 TEST_F(RenderFrameHostManagerTest, CleanUpSwappedOutRVHOnProcessCrash) { | 1515 TEST_F(RenderFrameHostManagerTest, CleanUpSwappedOutRVHOnProcessCrash) { |
| 1500 const GURL kUrl1("http://www.google.com/"); | 1516 const GURL kUrl1("http://www.google.com/"); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1754 | 1770 |
| 1755 // Navigate to the first page. | 1771 // Navigate to the first page. |
| 1756 contents()->NavigateAndCommit(kUrl1); | 1772 contents()->NavigateAndCommit(kUrl1); |
| 1757 TestRenderFrameHost* rfh1 = contents()->GetMainFrame(); | 1773 TestRenderFrameHost* rfh1 = contents()->GetMainFrame(); |
| 1758 RenderFrameHostDeletedObserver rfh_deleted_observer(rfh1); | 1774 RenderFrameHostDeletedObserver rfh_deleted_observer(rfh1); |
| 1759 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1775 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
| 1760 | 1776 |
| 1761 // Navigate to new site, simulating onbeforeunload approval. | 1777 // Navigate to new site, simulating onbeforeunload approval. |
| 1762 controller().LoadURL( | 1778 controller().LoadURL( |
| 1763 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 1779 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 1780 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 1764 contents()->GetMainFrame()->PrepareForCommit(); | 1781 contents()->GetMainFrame()->PrepareForCommit(); |
| 1765 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); | 1782 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
| 1766 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1783 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
| 1767 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); | 1784 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); |
| 1768 | 1785 |
| 1769 // Simulate the swap out ack, unexpectedly early (before commit). It should | 1786 // Simulate the swap out ack, unexpectedly early (before commit). It should |
| 1770 // have no effect. | 1787 // have no effect. |
| 1771 rfh1->OnSwappedOut(); | 1788 rfh1->OnSwappedOut(); |
| 1772 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); | 1789 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
| 1773 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1790 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
| 1774 | 1791 |
| 1775 // The new page commits. | 1792 // The new page commits. |
| 1776 contents()->TestDidNavigate(rfh2, 1, kUrl2, ui::PAGE_TRANSITION_TYPED); | 1793 contents()->TestDidNavigate(rfh2, 1, entry_id, true, kUrl2, |
| 1794 ui::PAGE_TRANSITION_TYPED); |
| 1777 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); | 1795 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); |
| 1778 EXPECT_EQ(rfh2, contents()->GetMainFrame()); | 1796 EXPECT_EQ(rfh2, contents()->GetMainFrame()); |
| 1779 EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); | 1797 EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); |
| 1780 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); | 1798 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); |
| 1781 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); | 1799 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); |
| 1782 EXPECT_TRUE( | 1800 EXPECT_TRUE( |
| 1783 rfh1->frame_tree_node()->render_manager()->IsPendingDeletion(rfh1)); | 1801 rfh1->frame_tree_node()->render_manager()->IsPendingDeletion(rfh1)); |
| 1784 | 1802 |
| 1785 // Simulate the swap out ack. | 1803 // Simulate the swap out ack. |
| 1786 rfh1->OnSwappedOut(); | 1804 rfh1->OnSwappedOut(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1802 RenderFrameHostDeletedObserver rfh_deleted_observer(rfh1); | 1820 RenderFrameHostDeletedObserver rfh_deleted_observer(rfh1); |
| 1803 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1821 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
| 1804 | 1822 |
| 1805 // Increment the number of active frames in SiteInstanceImpl so that rfh1 is | 1823 // Increment the number of active frames in SiteInstanceImpl so that rfh1 is |
| 1806 // not deleted on swap out. | 1824 // not deleted on swap out. |
| 1807 rfh1->GetSiteInstance()->increment_active_frame_count(); | 1825 rfh1->GetSiteInstance()->increment_active_frame_count(); |
| 1808 | 1826 |
| 1809 // Navigate to new site, simulating onbeforeunload approval. | 1827 // Navigate to new site, simulating onbeforeunload approval. |
| 1810 controller().LoadURL( | 1828 controller().LoadURL( |
| 1811 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 1829 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 1830 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 1812 contents()->GetMainFrame()->PrepareForCommit(); | 1831 contents()->GetMainFrame()->PrepareForCommit(); |
| 1813 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); | 1832 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
| 1814 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1833 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
| 1815 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); | 1834 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); |
| 1816 | 1835 |
| 1817 // The new page commits. | 1836 // The new page commits. |
| 1818 contents()->TestDidNavigate(rfh2, 1, kUrl2, ui::PAGE_TRANSITION_TYPED); | 1837 contents()->TestDidNavigate(rfh2, 1, entry_id, true, kUrl2, |
| 1838 ui::PAGE_TRANSITION_TYPED); |
| 1819 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); | 1839 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); |
| 1820 EXPECT_EQ(rfh2, contents()->GetMainFrame()); | 1840 EXPECT_EQ(rfh2, contents()->GetMainFrame()); |
| 1821 EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); | 1841 EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); |
| 1822 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); | 1842 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); |
| 1823 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); | 1843 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); |
| 1824 | 1844 |
| 1825 // Simulate the swap out ack. | 1845 // Simulate the swap out ack. |
| 1826 rfh1->OnSwappedOut(); | 1846 rfh1->OnSwappedOut(); |
| 1827 | 1847 |
| 1828 // rfh1 should be swapped out. | 1848 // rfh1 should be swapped out. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1845 RenderFrameHostDeletedObserver rfh_deleted_observer(rfh1); | 1865 RenderFrameHostDeletedObserver rfh_deleted_observer(rfh1); |
| 1846 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); | 1866 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh1->rfh_state()); |
| 1847 | 1867 |
| 1848 // Increment the number of active frames in SiteInstanceImpl so that rfh1 is | 1868 // Increment the number of active frames in SiteInstanceImpl so that rfh1 is |
| 1849 // not deleted on swap out. | 1869 // not deleted on swap out. |
| 1850 rfh1->GetSiteInstance()->increment_active_frame_count(); | 1870 rfh1->GetSiteInstance()->increment_active_frame_count(); |
| 1851 | 1871 |
| 1852 // Navigate to new site, simulating onbeforeunload approval. | 1872 // Navigate to new site, simulating onbeforeunload approval. |
| 1853 controller().LoadURL( | 1873 controller().LoadURL( |
| 1854 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); | 1874 kUrl2, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
| 1875 int entry_id = controller().GetPendingEntry()->GetUniqueID(); |
| 1855 rfh1->PrepareForCommit(); | 1876 rfh1->PrepareForCommit(); |
| 1856 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); | 1877 EXPECT_TRUE(contents()->CrossProcessNavigationPending()); |
| 1857 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); | 1878 TestRenderFrameHost* rfh2 = contents()->GetPendingMainFrame(); |
| 1858 | 1879 |
| 1859 // The new page commits. | 1880 // The new page commits. |
| 1860 contents()->TestDidNavigate(rfh2, 1, kUrl2, ui::PAGE_TRANSITION_TYPED); | 1881 contents()->TestDidNavigate(rfh2, 1, entry_id, true, kUrl2, |
| 1882 ui::PAGE_TRANSITION_TYPED); |
| 1861 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); | 1883 EXPECT_FALSE(contents()->CrossProcessNavigationPending()); |
| 1862 EXPECT_EQ(rfh2, contents()->GetMainFrame()); | 1884 EXPECT_EQ(rfh2, contents()->GetMainFrame()); |
| 1863 EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); | 1885 EXPECT_TRUE(contents()->GetPendingMainFrame() == NULL); |
| 1864 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); | 1886 EXPECT_EQ(RenderFrameHostImpl::STATE_DEFAULT, rfh2->rfh_state()); |
| 1865 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); | 1887 EXPECT_EQ(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT, rfh1->rfh_state()); |
| 1866 | 1888 |
| 1867 // Simulate the swap out ack. | 1889 // Simulate the swap out ack. |
| 1868 rfh1->OnSwappedOut(); | 1890 rfh1->OnSwappedOut(); |
| 1869 | 1891 |
| 1870 // rfh1 should be swapped out. | 1892 // rfh1 should be swapped out. |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive()); | 2125 EXPECT_FALSE(contents2->GetMainFrame()->IsRenderFrameLive()); |
| 2104 contents2->NavigateAndCommit(kUrl3); | 2126 contents2->NavigateAndCommit(kUrl3); |
| 2105 EXPECT_TRUE(contents2->GetMainFrame()->IsRenderFrameLive()); | 2127 EXPECT_TRUE(contents2->GetMainFrame()->IsRenderFrameLive()); |
| 2106 EXPECT_NE(nullptr, | 2128 EXPECT_NE(nullptr, |
| 2107 iframe->GetRenderFrameProxyHost(contents1->GetSiteInstance())); | 2129 iframe->GetRenderFrameProxyHost(contents1->GetSiteInstance())); |
| 2108 EXPECT_EQ(nullptr, | 2130 EXPECT_EQ(nullptr, |
| 2109 iframe->GetRenderFrameProxyHost(contents2->GetSiteInstance())); | 2131 iframe->GetRenderFrameProxyHost(contents2->GetSiteInstance())); |
| 2110 } | 2132 } |
| 2111 | 2133 |
| 2112 } // namespace content | 2134 } // namespace content |
| OLD | NEW |