| 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 bool ran_insecure_content = | 153 bool ran_insecure_content = |
| 154 !!(entry.GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT); | 154 !!(entry.GetSSL().content_status & SSLStatus::RAN_INSECURE_CONTENT); |
| 155 EXPECT_EQ(!!(expected_authentication_state & AuthState::RAN_INSECURE_CONTENT), | 155 EXPECT_EQ(!!(expected_authentication_state & AuthState::RAN_INSECURE_CONTENT), |
| 156 ran_insecure_content); | 156 ran_insecure_content); |
| 157 } | 157 } |
| 158 | 158 |
| 159 } // namespace AuthState | 159 } // namespace AuthState |
| 160 | 160 |
| 161 namespace SecurityStyle { | 161 namespace SecurityStyle { |
| 162 | 162 |
| 163 void Check(const NavigationEntry& entry, | 163 void Check( |
| 164 content::SecurityStyle expected_security_style) { | 164 WebContents* tab, |
| 165 EXPECT_EQ(expected_security_style, entry.GetSSL().security_style); | 165 security_state::SecurityStateModel::SecurityLevel expected_security_level) { |
| 166 ChromeSecurityStateModelClient* model_client = |
| 167 ChromeSecurityStateModelClient::FromWebContents(tab); |
| 168 security_state::SecurityStateModel::SecurityInfo security_info; |
| 169 model_client->GetSecurityInfo(&security_info); |
| 170 EXPECT_EQ(expected_security_level, security_info.security_level); |
| 166 } | 171 } |
| 167 | 172 |
| 168 } // namespace SecurityStyle | 173 } // namespace SecurityStyle |
| 169 | 174 |
| 170 namespace CertError { | 175 namespace CertError { |
| 171 | 176 |
| 172 enum CertErrorFlags { | 177 enum CertErrorFlags { |
| 173 NONE = 0 | 178 NONE = 0 |
| 174 }; | 179 }; |
| 175 | 180 |
| 176 void Check(const NavigationEntry& entry, net::CertStatus error) { | 181 void Check(const NavigationEntry& entry, net::CertStatus error) { |
| 177 if (error) { | 182 if (error) { |
| 178 EXPECT_EQ(error, entry.GetSSL().cert_status & error); | 183 EXPECT_EQ(error, entry.GetSSL().cert_status & error); |
| 179 net::CertStatus extra_cert_errors = | 184 net::CertStatus extra_cert_errors = |
| 180 error ^ (entry.GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); | 185 error ^ (entry.GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); |
| 181 EXPECT_FALSE(extra_cert_errors) << "Got unexpected cert error: " | 186 EXPECT_FALSE(extra_cert_errors) << "Got unexpected cert error: " |
| 182 << extra_cert_errors; | 187 << extra_cert_errors; |
| 183 } else { | 188 } else { |
| 184 EXPECT_EQ(0U, entry.GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); | 189 EXPECT_EQ(0U, entry.GetSSL().cert_status & net::CERT_STATUS_ALL_ERRORS); |
| 185 } | 190 } |
| 186 } | 191 } |
| 187 | 192 |
| 188 } // namespace CertError | 193 } // namespace CertError |
| 189 | 194 |
| 190 void CheckSecurityState(WebContents* tab, | 195 void CheckSecurityState( |
| 191 net::CertStatus expected_error, | 196 WebContents* tab, |
| 192 content::SecurityStyle expected_security_style, | 197 net::CertStatus expected_error, |
| 193 int expected_authentication_state) { | 198 security_state::SecurityStateModel::SecurityLevel expected_security_level, |
| 199 int expected_authentication_state) { |
| 194 ASSERT_FALSE(tab->IsCrashed()); | 200 ASSERT_FALSE(tab->IsCrashed()); |
| 195 NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 201 NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
| 196 ASSERT_TRUE(entry); | 202 ASSERT_TRUE(entry); |
| 197 CertError::Check(*entry, expected_error); | 203 CertError::Check(*entry, expected_error); |
| 198 SecurityStyle::Check(*entry, expected_security_style); | 204 SecurityStyle::Check(tab, expected_security_level); |
| 199 AuthState::Check(*entry, expected_authentication_state); | 205 AuthState::Check(*entry, expected_authentication_state); |
| 200 } | 206 } |
| 201 | 207 |
| 202 // This observer waits for the SSLErrorHandler to start an interstitial timer | 208 // This observer waits for the SSLErrorHandler to start an interstitial timer |
| 203 // for the given web contents. | 209 // for the given web contents. |
| 204 class SSLInterstitialTimerObserver { | 210 class SSLInterstitialTimerObserver { |
| 205 public: | 211 public: |
| 206 explicit SSLInterstitialTimerObserver(content::WebContents* web_contents) | 212 explicit SSLInterstitialTimerObserver(content::WebContents* web_contents) |
| 207 : web_contents_(web_contents), message_loop_runner_(new base::RunLoop) { | 213 : web_contents_(web_contents), message_loop_runner_(new base::RunLoop) { |
| 208 callback_ = base::Bind(&SSLInterstitialTimerObserver::OnTimerStarted, | 214 callback_ = base::Bind(&SSLInterstitialTimerObserver::OnTimerStarted, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 void SetUpCommandLine(base::CommandLine* command_line) override { | 309 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 304 // Browser will both run and display insecure content. | 310 // Browser will both run and display insecure content. |
| 305 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); | 311 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); |
| 306 // Use process-per-site so that navigating to a same-site page in a | 312 // Use process-per-site so that navigating to a same-site page in a |
| 307 // new tab will use the same process. | 313 // new tab will use the same process. |
| 308 command_line->AppendSwitch(switches::kProcessPerSite); | 314 command_line->AppendSwitch(switches::kProcessPerSite); |
| 309 } | 315 } |
| 310 | 316 |
| 311 void CheckAuthenticatedState(WebContents* tab, | 317 void CheckAuthenticatedState(WebContents* tab, |
| 312 int expected_authentication_state) { | 318 int expected_authentication_state) { |
| 313 CheckSecurityState(tab, | 319 CheckSecurityState(tab, CertError::NONE, |
| 314 CertError::NONE, | 320 security_state::SecurityStateModel::SECURE, |
| 315 content::SECURITY_STYLE_AUTHENTICATED, | |
| 316 expected_authentication_state); | 321 expected_authentication_state); |
| 317 } | 322 } |
| 318 | 323 |
| 319 void CheckUnauthenticatedState(WebContents* tab, | 324 void CheckUnauthenticatedState(WebContents* tab, |
| 320 int expected_authentication_state) { | 325 int expected_authentication_state) { |
| 321 CheckSecurityState(tab, | 326 CheckSecurityState(tab, CertError::NONE, |
| 322 CertError::NONE, | 327 security_state::SecurityStateModel::NONE, |
| 323 content::SECURITY_STYLE_UNAUTHENTICATED, | |
| 324 expected_authentication_state); | 328 expected_authentication_state); |
| 325 } | 329 } |
| 326 | 330 |
| 327 void CheckAuthenticationBrokenState(WebContents* tab, | 331 void CheckAuthenticationBrokenState(WebContents* tab, |
| 328 net::CertStatus error, | 332 net::CertStatus error, |
| 329 int expected_authentication_state) { | 333 int expected_authentication_state) { |
| 330 CheckSecurityState(tab, | 334 CheckSecurityState(tab, error, |
| 331 error, | 335 security_state::SecurityStateModel::DANGEROUS, |
| 332 content::SECURITY_STYLE_AUTHENTICATION_BROKEN, | |
| 333 expected_authentication_state); | 336 expected_authentication_state); |
| 334 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style | 337 // CERT_STATUS_UNABLE_TO_CHECK_REVOCATION doesn't lower the security style |
| 335 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. | 338 // to SECURITY_STYLE_AUTHENTICATION_BROKEN. |
| 336 ASSERT_NE(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION, error); | 339 ASSERT_NE(net::CERT_STATUS_UNABLE_TO_CHECK_REVOCATION, error); |
| 337 } | 340 } |
| 338 | 341 |
| 339 void CheckWorkerLoadResult(WebContents* tab, bool expected_load) { | 342 void CheckWorkerLoadResult(WebContents* tab, bool expected_load) { |
| 340 // Workers are async and we don't have notifications for them passing | 343 // Workers are async and we don't have notifications for them passing |
| 341 // messages since they do it between renderer and worker processes. | 344 // messages since they do it between renderer and worker processes. |
| 342 // So have a polling loop, check every 200ms, timeout at 30s. | 345 // So have a polling loop, check every 200ms, timeout at 30s. |
| (...skipping 1122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1465 | 1468 |
| 1466 std::string replacement_path; | 1469 std::string replacement_path; |
| 1467 GetFilePathWithHostAndPortReplacement( | 1470 GetFilePathWithHostAndPortReplacement( |
| 1468 "/ssl/page_displays_insecure_content.html", | 1471 "/ssl/page_displays_insecure_content.html", |
| 1469 embedded_test_server()->host_port_pair(), &replacement_path); | 1472 embedded_test_server()->host_port_pair(), &replacement_path); |
| 1470 | 1473 |
| 1471 // Load a page that displays insecure content. | 1474 // Load a page that displays insecure content. |
| 1472 ui_test_utils::NavigateToURL(browser(), | 1475 ui_test_utils::NavigateToURL(browser(), |
| 1473 https_server_.GetURL(replacement_path)); | 1476 https_server_.GetURL(replacement_path)); |
| 1474 | 1477 |
| 1475 CheckAuthenticatedState(browser()->tab_strip_model()->GetActiveWebContents(), | 1478 CheckSecurityState(browser()->tab_strip_model()->GetActiveWebContents(), |
| 1476 AuthState::DISPLAYED_INSECURE_CONTENT); | 1479 CertError::NONE, security_state::SecurityStateModel::NONE, |
| 1480 AuthState::DISPLAYED_INSECURE_CONTENT); |
| 1477 } | 1481 } |
| 1478 | 1482 |
| 1479 // Test that if the user proceeds and the checkbox is checked, a report | 1483 // Test that if the user proceeds and the checkbox is checked, a report |
| 1480 // is sent or not sent depending on the Finch config. | 1484 // is sent or not sent depending on the Finch config. |
| 1481 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, | 1485 IN_PROC_BROWSER_TEST_F(SSLUITestWithExtendedReporting, |
| 1482 TestBrokenHTTPSProceedReporting) { | 1486 TestBrokenHTTPSProceedReporting) { |
| 1483 certificate_reporting_test_utils::ExpectReport expect_report = | 1487 certificate_reporting_test_utils::ExpectReport expect_report = |
| 1484 certificate_reporting_test_utils::GetReportExpectedFromFinch(); | 1488 certificate_reporting_test_utils::GetReportExpectedFromFinch(); |
| 1485 TestBrokenHTTPSReporting( | 1489 TestBrokenHTTPSReporting( |
| 1486 certificate_reporting_test_utils::EXTENDED_REPORTING_OPT_IN, | 1490 certificate_reporting_test_utils::EXTENDED_REPORTING_OPT_IN, |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1732 params.tabstrip_index = 0; | 1736 params.tabstrip_index = 0; |
| 1733 params.source_contents = tab1; | 1737 params.source_contents = tab1; |
| 1734 content::WindowedNotificationObserver observer( | 1738 content::WindowedNotificationObserver observer( |
| 1735 content::NOTIFICATION_LOAD_STOP, | 1739 content::NOTIFICATION_LOAD_STOP, |
| 1736 content::NotificationService::AllSources()); | 1740 content::NotificationService::AllSources()); |
| 1737 chrome::Navigate(¶ms); | 1741 chrome::Navigate(¶ms); |
| 1738 WebContents* tab2 = params.target_contents; | 1742 WebContents* tab2 = params.target_contents; |
| 1739 observer.Wait(); | 1743 observer.Wait(); |
| 1740 | 1744 |
| 1741 // The new tab has insecure content. | 1745 // The new tab has insecure content. |
| 1742 CheckAuthenticatedState(tab2, AuthState::DISPLAYED_INSECURE_CONTENT); | 1746 CheckSecurityState(tab2, CertError::NONE, |
| 1747 security_state::SecurityStateModel::NONE, |
| 1748 AuthState::DISPLAYED_INSECURE_CONTENT); |
| 1743 | 1749 |
| 1744 // The original tab should not be contaminated. | 1750 // The original tab should not be contaminated. |
| 1745 CheckAuthenticatedState(tab1, AuthState::NONE); | 1751 CheckAuthenticatedState(tab1, AuthState::NONE); |
| 1746 } | 1752 } |
| 1747 | 1753 |
| 1748 // Visits two pages from the same origin: one that runs insecure content and one | 1754 // Visits two pages from the same origin: one that runs insecure content and one |
| 1749 // that doesn't. The test checks that we propagate the insecure content state | 1755 // that doesn't. The test checks that we propagate the insecure content state |
| 1750 // from one to the other. | 1756 // from one to the other. |
| 1751 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { | 1757 IN_PROC_BROWSER_TEST_F(SSLUITest, TestRunsInsecureContentTwoTabs) { |
| 1752 ASSERT_TRUE(embedded_test_server()->Start()); | 1758 ASSERT_TRUE(embedded_test_server()->Start()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 // Load original page over HTTP. | 1813 // Load original page over HTTP. |
| 1808 const GURL url_http = embedded_test_server()->GetURL(replacement_path); | 1814 const GURL url_http = embedded_test_server()->GetURL(replacement_path); |
| 1809 ui_test_utils::NavigateToURL(browser(), url_http); | 1815 ui_test_utils::NavigateToURL(browser(), url_http); |
| 1810 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1816 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1811 CheckUnauthenticatedState(tab, AuthState::NONE); | 1817 CheckUnauthenticatedState(tab, AuthState::NONE); |
| 1812 | 1818 |
| 1813 // Load again but over SSL. It should be marked as displaying insecure | 1819 // Load again but over SSL. It should be marked as displaying insecure |
| 1814 // content (even though the image comes from the WebCore memory cache). | 1820 // content (even though the image comes from the WebCore memory cache). |
| 1815 const GURL url_https = https_server_.GetURL(replacement_path); | 1821 const GURL url_https = https_server_.GetURL(replacement_path); |
| 1816 ui_test_utils::NavigateToURL(browser(), url_https); | 1822 ui_test_utils::NavigateToURL(browser(), url_https); |
| 1817 CheckAuthenticatedState(tab, AuthState::DISPLAYED_INSECURE_CONTENT); | 1823 CheckSecurityState(tab, CertError::NONE, |
| 1824 security_state::SecurityStateModel::NONE, |
| 1825 AuthState::DISPLAYED_INSECURE_CONTENT); |
| 1818 } | 1826 } |
| 1819 | 1827 |
| 1820 // http://crbug.com/84729 | 1828 // http://crbug.com/84729 |
| 1821 #if defined(OS_CHROMEOS) | 1829 #if defined(OS_CHROMEOS) |
| 1822 #define MAYBE_TestRunsCachedInsecureContent \ | 1830 #define MAYBE_TestRunsCachedInsecureContent \ |
| 1823 DISABLED_TestRunsCachedInsecureContent | 1831 DISABLED_TestRunsCachedInsecureContent |
| 1824 #else | 1832 #else |
| 1825 #define MAYBE_TestRunsCachedInsecureContent TestRunsCachedInsecureContent | 1833 #define MAYBE_TestRunsCachedInsecureContent TestRunsCachedInsecureContent |
| 1826 #endif // defined(OS_CHROMEOS) | 1834 #endif // defined(OS_CHROMEOS) |
| 1827 | 1835 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 " window.domAutomationController.setAutomationId(0);" | 2155 " window.domAutomationController.setAutomationId(0);" |
| 2148 " window.domAutomationController.send('mixed-image-loaded');" | 2156 " window.domAutomationController.send('mixed-image-loaded');" |
| 2149 "};" | 2157 "};" |
| 2150 "var img = document.createElement('img');" | 2158 "var img = document.createElement('img');" |
| 2151 "img.onload = loaded;" | 2159 "img.onload = loaded;" |
| 2152 "img.src = '" + | 2160 "img.src = '" + |
| 2153 https_url.spec() + "';" | 2161 https_url.spec() + "';" |
| 2154 "document.body.appendChild(img);")); | 2162 "document.body.appendChild(img);")); |
| 2155 | 2163 |
| 2156 content::RunMessageLoop(); | 2164 content::RunMessageLoop(); |
| 2157 CheckAuthenticatedState(tab, AuthState::DISPLAYED_INSECURE_CONTENT); | 2165 CheckSecurityState(tab, CertError::NONE, |
| 2166 security_state::SecurityStateModel::NONE, |
| 2167 AuthState::DISPLAYED_INSECURE_CONTENT); |
| 2158 } | 2168 } |
| 2159 | 2169 |
| 2160 // Visits a page to which we could not connect (bad port) over http and https | 2170 // Visits a page to which we could not connect (bad port) over http and https |
| 2161 // and make sure the security style is correct. | 2171 // and make sure the security style is correct. |
| 2162 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) { | 2172 IN_PROC_BROWSER_TEST_F(SSLUITest, TestConnectToBadPort) { |
| 2163 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17")); | 2173 ui_test_utils::NavigateToURL(browser(), GURL("http://localhost:17")); |
| 2164 CheckUnauthenticatedState( | 2174 CheckUnauthenticatedState( |
| 2165 browser()->tab_strip_model()->GetActiveWebContents(), | 2175 browser()->tab_strip_model()->GetActiveWebContents(), |
| 2166 AuthState::SHOWING_ERROR); | 2176 AuthState::SHOWING_ERROR); |
| 2167 | 2177 |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2514 EXPECT_EQ( | 2524 EXPECT_EQ( |
| 2515 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, | 2525 security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED_AND_RAN, |
| 2516 security_info.content_with_cert_errors_status); | 2526 security_info.content_with_cert_errors_status); |
| 2517 } | 2527 } |
| 2518 | 2528 |
| 2519 // Like the test above, but only displaying inactive content (an image). | 2529 // Like the test above, but only displaying inactive content (an image). |
| 2520 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeImageWithUserException) { | 2530 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeImageWithUserException) { |
| 2521 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2531 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 2522 ASSERT_NO_FATAL_FAILURE( | 2532 ASSERT_NO_FATAL_FAILURE( |
| 2523 SetUpUnsafeContentsWithUserException("/ssl/page_with_unsafe_image.html")); | 2533 SetUpUnsafeContentsWithUserException("/ssl/page_with_unsafe_image.html")); |
| 2524 CheckAuthenticatedState(tab, AuthState::NONE); | |
| 2525 | 2534 |
| 2526 ChromeSecurityStateModelClient* client = | 2535 ChromeSecurityStateModelClient* client = |
| 2527 ChromeSecurityStateModelClient::FromWebContents(tab); | 2536 ChromeSecurityStateModelClient::FromWebContents(tab); |
| 2528 ASSERT_TRUE(client); | 2537 ASSERT_TRUE(client); |
| 2529 security_state::SecurityStateModel::SecurityInfo security_info; | 2538 security_state::SecurityStateModel::SecurityInfo security_info; |
| 2530 client->GetSecurityInfo(&security_info); | 2539 client->GetSecurityInfo(&security_info); |
| 2531 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, | 2540 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_NONE, |
| 2532 security_info.mixed_content_status); | 2541 security_info.mixed_content_status); |
| 2533 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED, | 2542 EXPECT_EQ(security_state::SecurityStateModel::CONTENT_STATUS_DISPLAYED, |
| 2534 security_info.content_with_cert_errors_status); | 2543 security_info.content_with_cert_errors_status); |
| 2544 EXPECT_EQ(security_state::SecurityStateModel::NONE, |
| 2545 security_info.security_level); |
| 2546 EXPECT_EQ(0u, security_info.cert_status); |
| 2535 | 2547 |
| 2536 int img_width; | 2548 int img_width; |
| 2537 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( | 2549 EXPECT_TRUE(content::ExecuteScriptAndExtractInt( |
| 2538 tab, "window.domAutomationController.send(ImageWidth());", &img_width)); | 2550 tab, "window.domAutomationController.send(ImageWidth());", &img_width)); |
| 2539 // In order to check that the image was loaded, we check its width. | 2551 // In order to check that the image was loaded, we check its width. |
| 2540 // The actual image (Google logo) is 114 pixels wide, so we assume a good | 2552 // The actual image (Google logo) is 114 pixels wide, so we assume a good |
| 2541 // image is greater than 100. | 2553 // image is greater than 100. |
| 2542 EXPECT_GT(img_width, 100); | 2554 EXPECT_GT(img_width, 100); |
| 2543 } | 2555 } |
| 2544 | 2556 |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2889 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 2901 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
| 2890 content::TestNavigationObserver observer( | 2902 content::TestNavigationObserver observer( |
| 2891 contents, | 2903 contents, |
| 2892 // With PlzNavigate, the renderer only sees one navigation (i.e. not the | 2904 // With PlzNavigate, the renderer only sees one navigation (i.e. not the |
| 2893 // redirect, since that happens in the browser). | 2905 // redirect, since that happens in the browser). |
| 2894 content::IsBrowserSideNavigationEnabled() ? 1 : 2); | 2906 content::IsBrowserSideNavigationEnabled() ? 1 : 2); |
| 2895 ui_test_utils::NavigateToURL(browser(), https_server_mismatched_url); | 2907 ui_test_utils::NavigateToURL(browser(), https_server_mismatched_url); |
| 2896 observer.Wait(); | 2908 observer.Wait(); |
| 2897 | 2909 |
| 2898 CheckSecurityState(contents, CertError::NONE, | 2910 CheckSecurityState(contents, CertError::NONE, |
| 2899 content::SECURITY_STYLE_AUTHENTICATED, AuthState::NONE); | 2911 security_state::SecurityStateModel::SECURE, |
| 2912 AuthState::NONE); |
| 2900 replacements.SetHostStr("mail.example.com"); | 2913 replacements.SetHostStr("mail.example.com"); |
| 2901 GURL https_server_new_url = https_server_url.ReplaceComponents(replacements); | 2914 GURL https_server_new_url = https_server_url.ReplaceComponents(replacements); |
| 2902 // Verify that the current URL is the suggested URL. | 2915 // Verify that the current URL is the suggested URL. |
| 2903 EXPECT_EQ(https_server_new_url.spec(), | 2916 EXPECT_EQ(https_server_new_url.spec(), |
| 2904 contents->GetLastCommittedURL().spec()); | 2917 contents->GetLastCommittedURL().spec()); |
| 2905 } | 2918 } |
| 2906 | 2919 |
| 2907 // Visit the URL example.org on a server that presents a valid certificate | 2920 // Visit the URL example.org on a server that presents a valid certificate |
| 2908 // for www.example.org. Verify that the page redirects to www.example.org. | 2921 // for www.example.org. Verify that the page redirects to www.example.org. |
| 2909 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, | 2922 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2947 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); | 2960 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); |
| 2948 content::TestNavigationObserver observer( | 2961 content::TestNavigationObserver observer( |
| 2949 contents, | 2962 contents, |
| 2950 // With PlzNavigate, the renderer only sees one navigation (i.e. not the | 2963 // With PlzNavigate, the renderer only sees one navigation (i.e. not the |
| 2951 // redirect, since that happens in the browser). | 2964 // redirect, since that happens in the browser). |
| 2952 content::IsBrowserSideNavigationEnabled() ? 1 : 2); | 2965 content::IsBrowserSideNavigationEnabled() ? 1 : 2); |
| 2953 ui_test_utils::NavigateToURL(browser(), https_server_mismatched_url); | 2966 ui_test_utils::NavigateToURL(browser(), https_server_mismatched_url); |
| 2954 observer.Wait(); | 2967 observer.Wait(); |
| 2955 | 2968 |
| 2956 CheckSecurityState(contents, CertError::NONE, | 2969 CheckSecurityState(contents, CertError::NONE, |
| 2957 content::SECURITY_STYLE_AUTHENTICATED, AuthState::NONE); | 2970 security_state::SecurityStateModel::SECURE, |
| 2971 AuthState::NONE); |
| 2958 } | 2972 } |
| 2959 | 2973 |
| 2960 // Tests this scenario: | 2974 // Tests this scenario: |
| 2961 // - |CommonNameMismatchHandler| does not give a callback as it's set into the | 2975 // - |CommonNameMismatchHandler| does not give a callback as it's set into the |
| 2962 // state |IGNORE_REQUESTS_FOR_TESTING|. So no suggested URL check result can | 2976 // state |IGNORE_REQUESTS_FOR_TESTING|. So no suggested URL check result can |
| 2963 // arrive. | 2977 // arrive. |
| 2964 // - A cert error triggers an interstitial timer with a very long timeout. | 2978 // - A cert error triggers an interstitial timer with a very long timeout. |
| 2965 // - No suggested URL check results arrive, causing the tab to appear as loading | 2979 // - No suggested URL check results arrive, causing the tab to appear as loading |
| 2966 // indefinitely (also because the timer has a long timeout). | 2980 // indefinitely (also because the timer has a long timeout). |
| 2967 // - Stopping the page load shouldn't result in any interstitials. | 2981 // - Stopping the page load shouldn't result in any interstitials. |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3191 ASSERT_TRUE(https_server.Start()); | 3205 ASSERT_TRUE(https_server.Start()); |
| 3192 | 3206 |
| 3193 mock_cert_verifier()->set_default_result( | 3207 mock_cert_verifier()->set_default_result( |
| 3194 net::ERR_CERT_NAME_CONSTRAINT_VIOLATION); | 3208 net::ERR_CERT_NAME_CONSTRAINT_VIOLATION); |
| 3195 | 3209 |
| 3196 ui_test_utils::NavigateToURL(browser(), | 3210 ui_test_utils::NavigateToURL(browser(), |
| 3197 https_server.GetURL("/ssl/google.html")); | 3211 https_server.GetURL("/ssl/google.html")); |
| 3198 | 3212 |
| 3199 CheckSecurityState(browser()->tab_strip_model()->GetActiveWebContents(), | 3213 CheckSecurityState(browser()->tab_strip_model()->GetActiveWebContents(), |
| 3200 net::CERT_STATUS_NAME_CONSTRAINT_VIOLATION, | 3214 net::CERT_STATUS_NAME_CONSTRAINT_VIOLATION, |
| 3201 content::SECURITY_STYLE_AUTHENTICATION_BROKEN, | 3215 security_state::SecurityStateModel::DANGEROUS, |
| 3202 AuthState::SHOWING_INTERSTITIAL); | 3216 AuthState::SHOWING_INTERSTITIAL); |
| 3203 } | 3217 } |
| 3204 | 3218 |
| 3205 IN_PROC_BROWSER_TEST_F(SSLUITest, RestoreHasSSLState) { | 3219 IN_PROC_BROWSER_TEST_F(SSLUITest, RestoreHasSSLState) { |
| 3206 ASSERT_TRUE(https_server_.Start()); | 3220 ASSERT_TRUE(https_server_.Start()); |
| 3207 GURL url(https_server_.GetURL("/ssl/google.html")); | 3221 GURL url(https_server_.GetURL("/ssl/google.html")); |
| 3208 ui_test_utils::NavigateToURL(browser(), url); | 3222 ui_test_utils::NavigateToURL(browser(), url); |
| 3209 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 3223 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 3210 CheckAuthenticatedState(tab, AuthState::NONE); | 3224 CheckAuthenticatedState(tab, AuthState::NONE); |
| 3211 | 3225 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3311 ASSERT_TRUE(embedded_test_server()->Start()); | 3325 ASSERT_TRUE(embedded_test_server()->Start()); |
| 3312 ASSERT_TRUE(https_server_.Start()); | 3326 ASSERT_TRUE(https_server_.Start()); |
| 3313 | 3327 |
| 3314 GURL url = | 3328 GURL url = |
| 3315 GURL(https_server_.GetURL("/ssl/redirect.html").spec() | 3329 GURL(https_server_.GetURL("/ssl/redirect.html").spec() |
| 3316 + "?" + | 3330 + "?" + |
| 3317 https_server_.GetURL("/ssl/page_displays_insecure_content.html").spec()); | 3331 https_server_.GetURL("/ssl/page_displays_insecure_content.html").spec()); |
| 3318 | 3332 |
| 3319 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2); | 3333 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), url, 2); |
| 3320 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 3334 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 3321 CheckAuthenticatedState(tab, AuthState::DISPLAYED_INSECURE_CONTENT); | 3335 CheckSecurityState(tab, CertError::NONE, |
| 3336 security_state::SecurityStateModel::NONE, |
| 3337 AuthState::DISPLAYED_INSECURE_CONTENT); |
| 3322 } | 3338 } |
| 3323 | 3339 |
| 3324 // Checks that in-page navigations during page load preserves SSL state. | 3340 // Checks that in-page navigations during page load preserves SSL state. |
| 3325 IN_PROC_BROWSER_TEST_F(SSLUITest, InPageNavigationDuringLoadSSLState) { | 3341 IN_PROC_BROWSER_TEST_F(SSLUITest, InPageNavigationDuringLoadSSLState) { |
| 3326 ASSERT_TRUE(https_server_.Start()); | 3342 ASSERT_TRUE(https_server_.Start()); |
| 3327 | 3343 |
| 3328 ui_test_utils::NavigateToURL( | 3344 ui_test_utils::NavigateToURL( |
| 3329 browser(), | 3345 browser(), |
| 3330 https_server_.GetURL("/ssl/in_page_navigation_during_load.html")); | 3346 https_server_.GetURL("/ssl/in_page_navigation_during_load.html")); |
| 3331 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 3347 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3379 | 3395 |
| 3380 // Visit a page over https that contains a frame with a redirect. | 3396 // Visit a page over https that contains a frame with a redirect. |
| 3381 | 3397 |
| 3382 // XMLHttpRequest insecure content in synchronous mode. | 3398 // XMLHttpRequest insecure content in synchronous mode. |
| 3383 | 3399 |
| 3384 // XMLHttpRequest insecure content in asynchronous mode. | 3400 // XMLHttpRequest insecure content in asynchronous mode. |
| 3385 | 3401 |
| 3386 // XMLHttpRequest over bad ssl in synchronous mode. | 3402 // XMLHttpRequest over bad ssl in synchronous mode. |
| 3387 | 3403 |
| 3388 // XMLHttpRequest over OK ssl in synchronous mode. | 3404 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |