| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/frame_host/navigation_handle_impl.h" | 5 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 6 #include "content/browser/web_contents/web_contents_impl.h" | 6 #include "content/browser/web_contents/web_contents_impl.h" |
| 7 #include "content/public/browser/web_contents.h" | 7 #include "content/public/browser/web_contents.h" |
| 8 #include "content/public/browser/web_contents_observer.h" | 8 #include "content/public/browser/web_contents_observer.h" |
| 9 #include "content/public/common/request_context_type.h" | 9 #include "content/public/common/request_context_type.h" |
| 10 #include "content/public/test/browser_test_utils.h" | 10 #include "content/public/test/browser_test_utils.h" |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 EXPECT_EQ(link_url, url_recorder.urls().back()); | 801 EXPECT_EQ(link_url, url_recorder.urls().back()); |
| 802 EXPECT_EQ(2ul, url_recorder.urls().size()); | 802 EXPECT_EQ(2ul, url_recorder.urls().size()); |
| 803 EXPECT_EQ(REQUEST_CONTEXT_TYPE_HYPERLINK, | 803 EXPECT_EQ(REQUEST_CONTEXT_TYPE_HYPERLINK, |
| 804 installer.navigation_throttle()->request_context_type()); | 804 installer.navigation_throttle()->request_context_type()); |
| 805 | 805 |
| 806 // Finishes the last navigation. | 806 // Finishes the last navigation. |
| 807 link_manager.WaitForNavigationFinished(); | 807 link_manager.WaitForNavigationFinished(); |
| 808 EXPECT_FALSE(installer.navigation_throttle()); | 808 EXPECT_FALSE(installer.navigation_throttle()); |
| 809 } | 809 } |
| 810 | 810 |
| 811 IN_PROC_BROWSER_TEST_F(NavigationHandleImplBrowserTest, |
| 812 BugBaseline) { |
| 813 const char kChildFrameId[] = "child0"; |
| 814 GURL main_url(embedded_test_server()->GetURL( |
| 815 "a.com", "/frame_tree/page_with_one_frame.html")); |
| 816 GURL allowed_subframe_url(embedded_test_server()->GetURL( |
| 817 "a.com", "/title2.html")); |
| 818 |
| 819 ASSERT_TRUE(NavigateToURL(shell(), main_url)); |
| 820 ASSERT_TRUE(NavigateIframeToURL(shell()->web_contents(), kChildFrameId, |
| 821 allowed_subframe_url)); |
| 822 const char kScript[] = |
| 823 "let f = document.getElementById(\"%s\");" |
| 824 "window.domAutomationController.send(!!f.contentWindow);"; |
| 825 bool has_content_window = 0; |
| 826 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 827 shell(), base::StringPrintf(kScript, kChildFrameId), |
| 828 &has_content_window)); |
| 829 EXPECT_TRUE(has_content_window); |
| 830 } |
| 831 |
| 832 IN_PROC_BROWSER_TEST_F(NavigationHandleImplBrowserTest, |
| 833 BugRepro) { |
| 834 const char kChildFrameId[] = "child0"; |
| 835 GURL main_url(embedded_test_server()->GetURL( |
| 836 "a.com", "/frame_tree/page_with_one_frame.html")); |
| 837 GURL allowed_subframe_url(embedded_test_server()->GetURL( |
| 838 "a.com", "/cross-site/baz.com/title2.html")); |
| 839 |
| 840 ASSERT_TRUE(NavigateToURL(shell(), main_url)); |
| 841 ASSERT_TRUE(NavigateIframeToURL(shell()->web_contents(), kChildFrameId, |
| 842 allowed_subframe_url)); |
| 843 const char kScript[] = |
| 844 "let f = document.getElementById(\"%s\");" |
| 845 "window.domAutomationController.send(!!f.contentWindow);"; |
| 846 bool has_content_window = 0; |
| 847 EXPECT_TRUE(ExecuteScriptAndExtractBool( |
| 848 shell(), base::StringPrintf(kScript, kChildFrameId), |
| 849 &has_content_window)); |
| 850 EXPECT_TRUE(has_content_window); |
| 851 } |
| 852 |
| 811 // Checks that the RequestContextType value is properly set for an form (POST). | 853 // Checks that the RequestContextType value is properly set for an form (POST). |
| 812 IN_PROC_BROWSER_TEST_F(NavigationHandleImplBrowserTest, | 854 IN_PROC_BROWSER_TEST_F(NavigationHandleImplBrowserTest, |
| 813 VerifyFormRequestContextType) { | 855 VerifyFormRequestContextType) { |
| 814 GURL document_url( | 856 GURL document_url( |
| 815 embedded_test_server()->GetURL("/session_history/form.html")); | 857 embedded_test_server()->GetURL("/session_history/form.html")); |
| 816 GURL post_url(embedded_test_server()->GetURL("/echotitle")); | 858 GURL post_url(embedded_test_server()->GetURL("/echotitle")); |
| 817 | 859 |
| 818 TestNavigationThrottleInstaller installer( | 860 TestNavigationThrottleInstaller installer( |
| 819 shell()->web_contents(), NavigationThrottle::PROCEED, | 861 shell()->web_contents(), NavigationThrottle::PROCEED, |
| 820 NavigationThrottle::PROCEED, NavigationThrottle::PROCEED); | 862 NavigationThrottle::PROCEED, NavigationThrottle::PROCEED); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 898 IN_PROC_BROWSER_TEST_F(NavigationHandleImplHttpsUpgradeBrowserTest, | 940 IN_PROC_BROWSER_TEST_F(NavigationHandleImplHttpsUpgradeBrowserTest, |
| 899 StartUrlIsHttpsUpgradedCrossSite) { | 941 StartUrlIsHttpsUpgradedCrossSite) { |
| 900 GURL start_url( | 942 GURL start_url( |
| 901 embedded_test_server()->GetURL("/https_upgrade_cross_site.html")); | 943 embedded_test_server()->GetURL("/https_upgrade_cross_site.html")); |
| 902 GURL cross_site_iframe_secure_url("https://other.com/title1.html"); | 944 GURL cross_site_iframe_secure_url("https://other.com/title1.html"); |
| 903 | 945 |
| 904 CheckHttpsUpgradedIframeNavigation(start_url, cross_site_iframe_secure_url); | 946 CheckHttpsUpgradedIframeNavigation(start_url, cross_site_iframe_secure_url); |
| 905 } | 947 } |
| 906 | 948 |
| 907 } // namespace content | 949 } // namespace content |
| OLD | NEW |