| 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 // Since the ChromeBlobStorageContext posts a task to the BrowserThread, we |
| 831 // must run out the loop so the thread bundle is destroyed after this happens. |
| 832 base::RunLoop().RunUntilIdle(); |
| 830 } | 833 } |
| 831 | 834 |
| 832 // Regression test for http://crbug.com/386542 - variation of | 835 // Regression test for http://crbug.com/386542 - variation of |
| 833 // NavigateFromSitelessUrl in which the original navigation is a session | 836 // NavigateFromSitelessUrl in which the original navigation is a session |
| 834 // restore. | 837 // restore. |
| 835 TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) { | 838 TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) { |
| 836 WebContentsImplTestBrowserClient browser_client; | 839 WebContentsImplTestBrowserClient browser_client; |
| 837 SetBrowserClientForTesting(&browser_client); | 840 SetBrowserClientForTesting(&browser_client); |
| 838 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); | 841 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); |
| 839 TestRenderFrameHost* orig_rfh = main_test_rfh(); | 842 TestRenderFrameHost* orig_rfh = main_test_rfh(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 867 controller().LoadURL( | 870 controller().LoadURL( |
| 868 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 871 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 869 entry = controller().GetPendingEntry(); | 872 entry = controller().GetPendingEntry(); |
| 870 orig_rfh->PrepareForCommit(); | 873 orig_rfh->PrepareForCommit(); |
| 871 contents()->TestDidNavigate(orig_rfh, entry->GetUniqueID(), true, url, | 874 contents()->TestDidNavigate(orig_rfh, entry->GetUniqueID(), true, url, |
| 872 ui::PAGE_TRANSITION_TYPED); | 875 ui::PAGE_TRANSITION_TYPED); |
| 873 EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); | 876 EXPECT_EQ(orig_instance, contents()->GetSiteInstance()); |
| 874 | 877 |
| 875 // Cleanup. | 878 // Cleanup. |
| 876 DeleteContents(); | 879 DeleteContents(); |
| 880 // Since the ChromeBlobStorageContext posts a task to the BrowserThread, we |
| 881 // must run out the loop so the thread bundle is destroyed after this happens. |
| 882 base::RunLoop().RunUntilIdle(); |
| 877 } | 883 } |
| 878 | 884 |
| 879 // Complement for NavigateFromRestoredSitelessUrl, verifying that when a regular | 885 // Complement for NavigateFromRestoredSitelessUrl, verifying that when a regular |
| 880 // tab is restored, the SiteInstance will change upon navigation. | 886 // tab is restored, the SiteInstance will change upon navigation. |
| 881 TEST_F(WebContentsImplTest, NavigateFromRestoredRegularUrl) { | 887 TEST_F(WebContentsImplTest, NavigateFromRestoredRegularUrl) { |
| 882 WebContentsImplTestBrowserClient browser_client; | 888 WebContentsImplTestBrowserClient browser_client; |
| 883 SetBrowserClientForTesting(&browser_client); | 889 SetBrowserClientForTesting(&browser_client); |
| 884 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); | 890 SiteInstanceImpl* orig_instance = contents()->GetSiteInstance(); |
| 885 TestRenderFrameHost* orig_rfh = main_test_rfh(); | 891 TestRenderFrameHost* orig_rfh = main_test_rfh(); |
| 886 | 892 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 912 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); | 918 url, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| 913 entry = controller().GetPendingEntry(); | 919 entry = controller().GetPendingEntry(); |
| 914 orig_rfh->PrepareForCommit(); | 920 orig_rfh->PrepareForCommit(); |
| 915 contents()->TestDidNavigate(contents()->GetPendingMainFrame(), | 921 contents()->TestDidNavigate(contents()->GetPendingMainFrame(), |
| 916 entry->GetUniqueID(), true, url, | 922 entry->GetUniqueID(), true, url, |
| 917 ui::PAGE_TRANSITION_TYPED); | 923 ui::PAGE_TRANSITION_TYPED); |
| 918 EXPECT_NE(orig_instance, contents()->GetSiteInstance()); | 924 EXPECT_NE(orig_instance, contents()->GetSiteInstance()); |
| 919 | 925 |
| 920 // Cleanup. | 926 // Cleanup. |
| 921 DeleteContents(); | 927 DeleteContents(); |
| 928 // Since the ChromeBlobStorageContext posts a task to the BrowserThread, we |
| 929 // must run out the loop so the thread bundle is destroyed after this happens. |
| 930 base::RunLoop().RunUntilIdle(); |
| 922 } | 931 } |
| 923 | 932 |
| 924 // Test that we can find an opener RVH even if it's pending. | 933 // Test that we can find an opener RVH even if it's pending. |
| 925 // http://crbug.com/176252. | 934 // http://crbug.com/176252. |
| 926 TEST_F(WebContentsImplTest, FindOpenerRVHWhenPending) { | 935 TEST_F(WebContentsImplTest, FindOpenerRVHWhenPending) { |
| 927 TestRenderFrameHost* orig_rfh = main_test_rfh(); | 936 TestRenderFrameHost* orig_rfh = main_test_rfh(); |
| 928 | 937 |
| 929 // Navigate to a URL. | 938 // Navigate to a URL. |
| 930 const GURL url("http://www.google.com"); | 939 const GURL url("http://www.google.com"); |
| 931 controller().LoadURL( | 940 controller().LoadURL( |
| (...skipping 2481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3413 // An automatic navigation. | 3422 // An automatic navigation. |
| 3414 main_test_rfh()->SendNavigateWithModificationCallback( | 3423 main_test_rfh()->SendNavigateWithModificationCallback( |
| 3415 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); | 3424 0, true, GURL(url::kAboutBlankURL), base::Bind(SetAsNonUserGesture)); |
| 3416 | 3425 |
| 3417 EXPECT_EQ(1u, dialog_manager.reset_count()); | 3426 EXPECT_EQ(1u, dialog_manager.reset_count()); |
| 3418 | 3427 |
| 3419 contents()->SetJavaScriptDialogManagerForTesting(nullptr); | 3428 contents()->SetJavaScriptDialogManagerForTesting(nullptr); |
| 3420 } | 3429 } |
| 3421 | 3430 |
| 3422 } // namespace content | 3431 } // namespace content |
| OLD | NEW |