| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 // We keep a proxy for the original RFH's SiteInstance. | 820 // We keep a proxy for the original RFH's SiteInstance. |
| 821 EXPECT_TRUE(contents()->GetRenderManagerForTesting()->GetRenderFrameProxyHost( | 821 EXPECT_TRUE(contents()->GetRenderManagerForTesting()->GetRenderFrameProxyHost( |
| 822 orig_rfh->GetSiteInstance())); | 822 orig_rfh->GetSiteInstance())); |
| 823 EXPECT_EQ(orig_rvh_delete_count, 0); | 823 EXPECT_EQ(orig_rvh_delete_count, 0); |
| 824 orig_rfh->OnSwappedOut(); | 824 orig_rfh->OnSwappedOut(); |
| 825 | 825 |
| 826 // Close contents and ensure RVHs are deleted. | 826 // Close contents and ensure RVHs are deleted. |
| 827 DeleteContents(); | 827 DeleteContents(); |
| 828 EXPECT_EQ(orig_rvh_delete_count, 1); | 828 EXPECT_EQ(orig_rvh_delete_count, 1); |
| 829 EXPECT_EQ(pending_rvh_delete_count, 1); | 829 EXPECT_EQ(pending_rvh_delete_count, 1); |
| 830 base::RunLoop().RunUntilIdle(); |
| 830 } | 831 } |
| 831 | 832 |
| 832 // Regression test for http://crbug.com/386542 - variation of | 833 // Regression test for http://crbug.com/386542 - variation of |
| 833 // NavigateFromSitelessUrl in which the original navigation is a session | 834 // NavigateFromSitelessUrl in which the original navigation is a session |
| 834 // restore. | 835 // restore. |
| 835 TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) { | 836 TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) { |
| 836 WebContentsImplTestBrowserClient browser_client; | 837 WebContentsImplTestBrowserClient browser_client; |
| 837 SetBrowserClientForTesting(&browser_client); | 838 SetBrowserClientForTesting(&browser_client); |
| 838 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); | 839 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); |
| 839 TestRenderFrameHost* orig_rfh = main_test_rfh(); | 840 TestRenderFrameHost* orig_rfh = main_test_rfh(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 867 controller().LoadURL( | 868 controller().LoadURL( |
| 868 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 869 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 869 entry = controller().GetPendingEntry(); | 870 entry = controller().GetPendingEntry(); |
| 870 orig_rfh->PrepareForCommit(); | 871 orig_rfh->PrepareForCommit(); |
| 871 contents()->TestDidNavigate(orig_rfh, entry->GetUniqueID(), true, url, | 872 contents()->TestDidNavigate(orig_rfh, entry->GetUniqueID(), true, url, |
| 872 ui::PAGE_TRANSITION_TYPED); | 873 ui::PAGE_TRANSITION_TYPED); |
| 873 EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); | 874 EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); |
| 874 | 875 |
| 875 // Cleanup. | 876 // Cleanup. |
| 876 DeleteContents(); | 877 DeleteContents(); |
| 878 base::RunLoop().RunUntilIdle(); |
| 877 } | 879 } |
| 878 | 880 |
| 879 // Complement for NavigateFromRestoredSitelessUrl, verifying that when a regular | 881 // Complement for NavigateFromRestoredSitelessUrl, verifying that when a regular |
| 880 // tab is restored, the SiteInstance will change upon navigation. | 882 // tab is restored, the SiteInstance will change upon navigation. |
| 881 TEST_F(WebContentsImplTest, NavigateFromRestoredRegularUrl) { | 883 TEST_F(WebContentsImplTest, NavigateFromRestoredRegularUrl) { |
| 882 WebContentsImplTestBrowserClient browser_client; | 884 WebContentsImplTestBrowserClient browser_client; |
| 883 SetBrowserClientForTesting(&browser_client); | 885 SetBrowserClientForTesting(&browser_client); |
| 884 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); | 886 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); |
| 885 TestRenderFrameHost* orig_rfh = main_test_rfh(); | 887 TestRenderFrameHost* orig_rfh = main_test_rfh(); |
| 886 | 888 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 912 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 914 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 913 entry = controller().GetPendingEntry(); | 915 entry = controller().GetPendingEntry(); |
| 914 orig_rfh->PrepareForCommit(); | 916 orig_rfh->PrepareForCommit(); |
| 915 contents()->TestDidNavigate(contents()->GetPendingMainFrame(), | 917 contents()->TestDidNavigate(contents()->GetPendingMainFrame(), |
| 916 entry->GetUniqueID(), true, url, | 918 entry->GetUniqueID(), true, url, |
| 917 ui::PAGE_TRANSITION_TYPED); | 919 ui::PAGE_TRANSITION_TYPED); |
| 918 EXPECT_NE(orig_instance, contents()->GetSiteInstance()); | 920 EXPECT_NE(orig_instance, contents()->GetSiteInstance()); |
| 919 | 921 |
| 920 // Cleanup. | 922 // Cleanup. |
| 921 DeleteContents(); | 923 DeleteContents(); |
| 924 base::RunLoop().RunUntilIdle(); |
| 922 } | 925 } |
| 923 | 926 |
| 924 // Test that we can find an opener RVH even if it's pending. | 927 // Test that we can find an opener RVH even if it's pending. |
| 925 // http://crbug.com/176252. | 928 // http://crbug.com/176252. |
| 926 TEST_F(WebContentsImplTest, FindOpenerRVHWhenPending) { | 929 TEST_F(WebContentsImplTest, FindOpenerRVHWhenPending) { |
| 927 TestRenderFrameHost* orig_rfh = main_test_rfh(); | 930 TestRenderFrameHost* orig_rfh = main_test_rfh(); |
| 928 | 931 |
| 929 // Navigate to a URL. | 932 // Navigate to a URL. |
| 930 const GURL url("http://www.google.com"); | 933 const GURL url("http://www.google.com"); |
| 931 controller().LoadURL( | 934 controller().LoadURL( |
| (...skipping 2481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3413 // An automatic navigation. | 3416 // An automatic navigation. |
| 3414 main_test_rfh()->SendNavigateWithModificationCallback( | 3417 main_test_rfh()->SendNavigateWithModificationCallback( |
| 3415 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); | 3418 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); |
| 3416 | 3419 |
| 3417 EXPECT_EQ(1u, dialog_manager.reset_count()); | 3420 EXPECT_EQ(1u, dialog_manager.reset_count()); |
| 3418 | 3421 |
| 3419 contents()->SetJavaScriptDialogManagerForTesting(nullptr); | 3422 contents()->SetJavaScriptDialogManagerForTesting(nullptr); |
| 3420 } | 3423 } |
| 3421 | 3424 |
| 3422 } // namespace content | 3425 } // namespace content |
| OLD | NEW |