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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 353 } |
354 | 354 |
355 void SetUpCommandLine(base::CommandLine* command_line) override { | 355 void SetUpCommandLine(base::CommandLine* command_line) override { |
356 // Browser will both run and display insecure content. | 356 // Browser will both run and display insecure content. |
357 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); | 357 command_line->AppendSwitch(switches::kAllowRunningInsecureContent); |
358 // Use process-per-site so that navigating to a same-site page in a | 358 // Use process-per-site so that navigating to a same-site page in a |
359 // new tab will use the same process. | 359 // new tab will use the same process. |
360 command_line->AppendSwitch(switches::kProcessPerSite); | 360 command_line->AppendSwitch(switches::kProcessPerSite); |
361 } | 361 } |
362 | 362 |
| 363 void SetUpOnMainThread() override { |
| 364 host_resolver()->AddRule("*", "127.0.0.1"); |
| 365 } |
| 366 |
363 void CheckAuthenticatedState(WebContents* tab, | 367 void CheckAuthenticatedState(WebContents* tab, |
364 int expected_authentication_state) { | 368 int expected_authentication_state) { |
365 CheckSecurityState(tab, CertError::NONE, security_state::SECURE, | 369 CheckSecurityState(tab, CertError::NONE, security_state::SECURE, |
366 expected_authentication_state); | 370 expected_authentication_state); |
367 } | 371 } |
368 | 372 |
369 void CheckUnauthenticatedState(WebContents* tab, | 373 void CheckUnauthenticatedState(WebContents* tab, |
370 int expected_authentication_state) { | 374 int expected_authentication_state) { |
371 CheckSecurityState(tab, CertError::NONE, security_state::NONE, | 375 CheckSecurityState(tab, CertError::NONE, security_state::NONE, |
372 expected_authentication_state); | 376 expected_authentication_state); |
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1742 DISABLED_TestDisplaysInsecureContentLoadedFromJS | 1746 DISABLED_TestDisplaysInsecureContentLoadedFromJS |
1743 #else | 1747 #else |
1744 #define MAYBE_TestDisplaysInsecureContentLoadedFromJS \ | 1748 #define MAYBE_TestDisplaysInsecureContentLoadedFromJS \ |
1745 TestDisplaysInsecureContentLoadedFromJS | 1749 TestDisplaysInsecureContentLoadedFromJS |
1746 #endif | 1750 #endif |
1747 IN_PROC_BROWSER_TEST_F(SSLUITest, | 1751 IN_PROC_BROWSER_TEST_F(SSLUITest, |
1748 MAYBE_TestDisplaysInsecureContentLoadedFromJS) { | 1752 MAYBE_TestDisplaysInsecureContentLoadedFromJS) { |
1749 ASSERT_TRUE(embedded_test_server()->Start()); | 1753 ASSERT_TRUE(embedded_test_server()->Start()); |
1750 ASSERT_TRUE(https_server_.Start()); | 1754 ASSERT_TRUE(https_server_.Start()); |
1751 | 1755 |
1752 host_resolver()->AddRule("example.test", | |
1753 https_server_.GetURL("/title1.html").host()); | |
1754 | |
1755 net::HostPortPair replacement_pair = embedded_test_server()->host_port_pair(); | 1756 net::HostPortPair replacement_pair = embedded_test_server()->host_port_pair(); |
1756 replacement_pair.set_host("example.test"); | 1757 replacement_pair.set_host("example.test"); |
1757 | 1758 |
1758 std::string replacement_path; | 1759 std::string replacement_path; |
1759 GetFilePathWithHostAndPortReplacement( | 1760 GetFilePathWithHostAndPortReplacement( |
1760 "/ssl/page_with_dynamic_insecure_content.html", | 1761 "/ssl/page_with_dynamic_insecure_content.html", |
1761 replacement_pair, &replacement_path); | 1762 replacement_pair, &replacement_path); |
1762 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 1763 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
1763 replacement_path)); | 1764 replacement_path)); |
1764 | 1765 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2144 | 2145 |
2145 class SSLUITestWaitForDOMNotification : public SSLUITestIgnoreCertErrors, | 2146 class SSLUITestWaitForDOMNotification : public SSLUITestIgnoreCertErrors, |
2146 public content::NotificationObserver { | 2147 public content::NotificationObserver { |
2147 public: | 2148 public: |
2148 SSLUITestWaitForDOMNotification() | 2149 SSLUITestWaitForDOMNotification() |
2149 : SSLUITestIgnoreCertErrors(), run_loop_(nullptr) {} | 2150 : SSLUITestIgnoreCertErrors(), run_loop_(nullptr) {} |
2150 | 2151 |
2151 ~SSLUITestWaitForDOMNotification() override { registrar_.RemoveAll(); }; | 2152 ~SSLUITestWaitForDOMNotification() override { registrar_.RemoveAll(); }; |
2152 | 2153 |
2153 void SetUpOnMainThread() override { | 2154 void SetUpOnMainThread() override { |
| 2155 SSLUITestIgnoreCertErrors::SetUpOnMainThread(); |
2154 registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE, | 2156 registrar_.Add(this, content::NOTIFICATION_DOM_OPERATION_RESPONSE, |
2155 content::NotificationService::AllSources()); | 2157 content::NotificationService::AllSources()); |
2156 } | 2158 } |
2157 | 2159 |
2158 void set_expected_notification(const std::string& expected_notification) { | 2160 void set_expected_notification(const std::string& expected_notification) { |
2159 expected_notification_ = expected_notification; | 2161 expected_notification_ = expected_notification; |
2160 } | 2162 } |
2161 | 2163 |
2162 void set_run_loop(base::RunLoop* run_loop) { run_loop_ = run_loop; } | 2164 void set_run_loop(base::RunLoop* run_loop) { run_loop_ = run_loop; } |
2163 | 2165 |
(...skipping 18 matching lines...) Expand all Loading... |
2182 DISALLOW_COPY_AND_ASSIGN(SSLUITestWaitForDOMNotification); | 2184 DISALLOW_COPY_AND_ASSIGN(SSLUITestWaitForDOMNotification); |
2183 }; | 2185 }; |
2184 | 2186 |
2185 // Tests that a mixed resource which includes HTTP in the redirect chain | 2187 // Tests that a mixed resource which includes HTTP in the redirect chain |
2186 // is marked as mixed content, even if the end result is HTTPS. | 2188 // is marked as mixed content, even if the end result is HTTPS. |
2187 IN_PROC_BROWSER_TEST_F(SSLUITestWaitForDOMNotification, | 2189 IN_PROC_BROWSER_TEST_F(SSLUITestWaitForDOMNotification, |
2188 TestMixedContentWithHTTPInRedirectChain) { | 2190 TestMixedContentWithHTTPInRedirectChain) { |
2189 ASSERT_TRUE(embedded_test_server()->Start()); | 2191 ASSERT_TRUE(embedded_test_server()->Start()); |
2190 ASSERT_TRUE(https_server_.Start()); | 2192 ASSERT_TRUE(https_server_.Start()); |
2191 | 2193 |
2192 host_resolver()->AddRule("*", embedded_test_server()->GetURL("/").host()); | |
2193 | |
2194 ui_test_utils::NavigateToURL(browser(), | 2194 ui_test_utils::NavigateToURL(browser(), |
2195 https_server_.GetURL("/ssl/blank_page.html")); | 2195 https_server_.GetURL("/ssl/blank_page.html")); |
2196 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2196 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
2197 CheckAuthenticatedState(tab, AuthState::NONE); | 2197 CheckAuthenticatedState(tab, AuthState::NONE); |
2198 | 2198 |
2199 // Construct a URL which will be dynamically added to the page as an | 2199 // Construct a URL which will be dynamically added to the page as an |
2200 // image. The URL redirects through HTTP, though it ends up at an | 2200 // image. The URL redirects through HTTP, though it ends up at an |
2201 // HTTPS resource. | 2201 // HTTPS resource. |
2202 GURL http_url = embedded_test_server()->GetURL("/server-redirect?"); | 2202 GURL http_url = embedded_test_server()->GetURL("/server-redirect?"); |
2203 GURL::Replacements http_url_replacements; | 2203 GURL::Replacements http_url_replacements; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2263 // From a good HTTPS top frame: | 2263 // From a good HTTPS top frame: |
2264 // - navigate to an OK HTTPS frame | 2264 // - navigate to an OK HTTPS frame |
2265 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then | 2265 // - navigate to a bad HTTPS (expect unsafe content and filtered frame), then |
2266 // back | 2266 // back |
2267 // - navigate to HTTP (expect insecure content), then back | 2267 // - navigate to HTTP (expect insecure content), then back |
2268 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { | 2268 IN_PROC_BROWSER_TEST_F(SSLUITest, TestGoodFrameNavigation) { |
2269 ASSERT_TRUE(embedded_test_server()->Start()); | 2269 ASSERT_TRUE(embedded_test_server()->Start()); |
2270 ASSERT_TRUE(https_server_.Start()); | 2270 ASSERT_TRUE(https_server_.Start()); |
2271 ASSERT_TRUE(https_server_expired_.Start()); | 2271 ASSERT_TRUE(https_server_expired_.Start()); |
2272 | 2272 |
2273 // Make sure to add this hostname to the resolver so that it's not blocked | 2273 // SetUpOnMainThread adds this hostname to the resolver so that it's not |
2274 // (browser_test_base.cc has a resolver that blocks all non-local hostnames | 2274 // blocked (browser_test_base.cc has a resolver that blocks all non-local |
2275 // by default to ensure tests don't hit the network). This is critical to do | 2275 // hostnames by default to ensure tests don't hit the network). This is |
2276 // because for PlzNavigate the request would otherwise get cancelled in the | 2276 // critical to do because for PlzNavigate the request would otherwise get |
2277 // browser before the renderer sees it. | 2277 // cancelled in the browser before the renderer sees it. |
2278 host_resolver()->AddRule( | |
2279 "example.test", | |
2280 embedded_test_server()->GetURL("/title1.html").host()); | |
2281 | 2278 |
2282 std::string top_frame_path; | 2279 std::string top_frame_path; |
2283 GetTopFramePath(*embedded_test_server(), https_server_, https_server_expired_, | 2280 GetTopFramePath(*embedded_test_server(), https_server_, https_server_expired_, |
2284 &top_frame_path); | 2281 &top_frame_path); |
2285 | 2282 |
2286 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2283 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
2287 ui_test_utils::NavigateToURL(browser(), | 2284 ui_test_utils::NavigateToURL(browser(), |
2288 https_server_.GetURL(top_frame_path)); | 2285 https_server_.GetURL(top_frame_path)); |
2289 | 2286 |
2290 CheckAuthenticatedState(tab, AuthState::NONE); | 2287 CheckAuthenticatedState(tab, AuthState::NONE); |
(...skipping 789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3080 "<SSLNetworkTimeBrowserTestFieldTrial"); | 3077 "<SSLNetworkTimeBrowserTestFieldTrial"); |
3081 command_line->AppendSwitchASCII( | 3078 command_line->AppendSwitchASCII( |
3082 switches::kForceFieldTrials, | 3079 switches::kForceFieldTrials, |
3083 "SSLNetworkTimeBrowserTestFieldTrial/Enabled/"); | 3080 "SSLNetworkTimeBrowserTestFieldTrial/Enabled/"); |
3084 command_line->AppendSwitchASCII( | 3081 command_line->AppendSwitchASCII( |
3085 variations::switches::kForceFieldTrialParams, | 3082 variations::switches::kForceFieldTrialParams, |
3086 "SSLNetworkTimeBrowserTestFieldTrial.Enabled:FetchBehavior/" | 3083 "SSLNetworkTimeBrowserTestFieldTrial.Enabled:FetchBehavior/" |
3087 "on-demand-only"); | 3084 "on-demand-only"); |
3088 } | 3085 } |
3089 | 3086 |
3090 void SetUpOnMainThread() override { SetUpNetworkTimeServer(); } | 3087 void SetUpOnMainThread() override { |
| 3088 SSLUITest::SetUpOnMainThread(); |
| 3089 SetUpNetworkTimeServer(); |
| 3090 } |
3091 | 3091 |
3092 void TearDownOnMainThread() override { | 3092 void TearDownOnMainThread() override { |
3093 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, | 3093 content::BrowserThread::PostTask(content::BrowserThread::IO, FROM_HERE, |
3094 base::Bind(&CleanUpOnIOThread)); | 3094 base::Bind(&CleanUpOnIOThread)); |
3095 } | 3095 } |
3096 | 3096 |
3097 protected: | 3097 protected: |
3098 void SetUpNetworkTimeServer() { | 3098 void SetUpNetworkTimeServer() { |
3099 // Install the URL interceptor that serves delayed network time responses. | 3099 // Install the URL interceptor that serves delayed network time responses. |
3100 interceptor_ = new DelayedNetworkTimeInterceptor(); | 3100 interceptor_ = new DelayedNetworkTimeInterceptor(); |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3398 class CommonNameMismatchBrowserTest : public CertVerifierBrowserTest { | 3398 class CommonNameMismatchBrowserTest : public CertVerifierBrowserTest { |
3399 public: | 3399 public: |
3400 CommonNameMismatchBrowserTest() : CertVerifierBrowserTest() {} | 3400 CommonNameMismatchBrowserTest() : CertVerifierBrowserTest() {} |
3401 ~CommonNameMismatchBrowserTest() override {} | 3401 ~CommonNameMismatchBrowserTest() override {} |
3402 | 3402 |
3403 void SetUpCommandLine(base::CommandLine* command_line) override { | 3403 void SetUpCommandLine(base::CommandLine* command_line) override { |
3404 // Enable finch experiment for SSL common name mismatch handling. | 3404 // Enable finch experiment for SSL common name mismatch handling. |
3405 command_line->AppendSwitchASCII(switches::kForceFieldTrials, | 3405 command_line->AppendSwitchASCII(switches::kForceFieldTrials, |
3406 "SSLCommonNameMismatchHandling/Enabled/"); | 3406 "SSLCommonNameMismatchHandling/Enabled/"); |
3407 } | 3407 } |
| 3408 |
| 3409 void SetUpOnMainThread() override { |
| 3410 CertVerifierBrowserTest::SetUpOnMainThread(); |
| 3411 host_resolver()->AddRule("*", "127.0.0.1"); |
| 3412 } |
3408 }; | 3413 }; |
3409 | 3414 |
3410 // Visit the URL www.mail.example.com on a server that presents a valid | 3415 // Visit the URL www.mail.example.com on a server that presents a valid |
3411 // certificate for mail.example.com. Verify that the page navigates to | 3416 // certificate for mail.example.com. Verify that the page navigates to |
3412 // mail.example.com. | 3417 // mail.example.com. |
3413 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, | 3418 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, |
3414 ShouldShowWWWSubdomainMismatchInterstitial) { | 3419 ShouldShowWWWSubdomainMismatchInterstitial) { |
3415 net::EmbeddedTestServer https_server_example_domain_( | 3420 net::EmbeddedTestServer https_server_example_domain_( |
3416 net::EmbeddedTestServer::TYPE_HTTPS); | 3421 net::EmbeddedTestServer::TYPE_HTTPS); |
3417 https_server_example_domain_.ServeFilesFromSourceDirectory( | 3422 https_server_example_domain_.ServeFilesFromSourceDirectory( |
3418 base::FilePath(kDocRoot)); | 3423 base::FilePath(kDocRoot)); |
3419 ASSERT_TRUE(https_server_example_domain_.Start()); | 3424 ASSERT_TRUE(https_server_example_domain_.Start()); |
3420 | 3425 |
3421 host_resolver()->AddRule( | |
3422 "mail.example.com", https_server_example_domain_.host_port_pair().host()); | |
3423 host_resolver()->AddRule( | |
3424 "www.mail.example.com", | |
3425 https_server_example_domain_.host_port_pair().host()); | |
3426 | |
3427 scoped_refptr<net::X509Certificate> cert = | 3426 scoped_refptr<net::X509Certificate> cert = |
3428 https_server_example_domain_.GetCertificate(); | 3427 https_server_example_domain_.GetCertificate(); |
3429 | 3428 |
3430 // Use the "spdy_pooling.pem" cert which has "mail.example.com" | 3429 // Use the "spdy_pooling.pem" cert which has "mail.example.com" |
3431 // as one of its SANs. | 3430 // as one of its SANs. |
3432 net::CertVerifyResult verify_result; | 3431 net::CertVerifyResult verify_result; |
3433 verify_result.verified_cert = | 3432 verify_result.verified_cert = |
3434 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); | 3433 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); |
3435 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; | 3434 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; |
3436 | 3435 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3477 // Visit the URL example.org on a server that presents a valid certificate | 3476 // Visit the URL example.org on a server that presents a valid certificate |
3478 // for www.example.org. Verify that the page redirects to www.example.org. | 3477 // for www.example.org. Verify that the page redirects to www.example.org. |
3479 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, | 3478 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, |
3480 CheckWWWSubdomainMismatchInverse) { | 3479 CheckWWWSubdomainMismatchInverse) { |
3481 net::EmbeddedTestServer https_server_example_domain_( | 3480 net::EmbeddedTestServer https_server_example_domain_( |
3482 net::EmbeddedTestServer::TYPE_HTTPS); | 3481 net::EmbeddedTestServer::TYPE_HTTPS); |
3483 https_server_example_domain_.ServeFilesFromSourceDirectory( | 3482 https_server_example_domain_.ServeFilesFromSourceDirectory( |
3484 base::FilePath(kDocRoot)); | 3483 base::FilePath(kDocRoot)); |
3485 ASSERT_TRUE(https_server_example_domain_.Start()); | 3484 ASSERT_TRUE(https_server_example_domain_.Start()); |
3486 | 3485 |
3487 host_resolver()->AddRule( | |
3488 "www.example.org", https_server_example_domain_.host_port_pair().host()); | |
3489 host_resolver()->AddRule( | |
3490 "example.org", https_server_example_domain_.host_port_pair().host()); | |
3491 | |
3492 scoped_refptr<net::X509Certificate> cert = | 3486 scoped_refptr<net::X509Certificate> cert = |
3493 https_server_example_domain_.GetCertificate(); | 3487 https_server_example_domain_.GetCertificate(); |
3494 | 3488 |
3495 net::CertVerifyResult verify_result; | 3489 net::CertVerifyResult verify_result; |
3496 verify_result.verified_cert = | 3490 verify_result.verified_cert = |
3497 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); | 3491 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); |
3498 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; | 3492 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; |
3499 | 3493 |
3500 mock_cert_verifier()->AddResultForCertAndHost( | 3494 mock_cert_verifier()->AddResultForCertAndHost( |
3501 cert.get(), "example.org", verify_result, | 3495 cert.get(), "example.org", verify_result, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3536 // indefinitely (also because the timer has a long timeout). | 3530 // indefinitely (also because the timer has a long timeout). |
3537 // - Stopping the page load shouldn't result in any interstitials. | 3531 // - Stopping the page load shouldn't result in any interstitials. |
3538 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, | 3532 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, |
3539 InterstitialStopNavigationWhileLoading) { | 3533 InterstitialStopNavigationWhileLoading) { |
3540 net::EmbeddedTestServer https_server_example_domain_( | 3534 net::EmbeddedTestServer https_server_example_domain_( |
3541 net::EmbeddedTestServer::TYPE_HTTPS); | 3535 net::EmbeddedTestServer::TYPE_HTTPS); |
3542 https_server_example_domain_.ServeFilesFromSourceDirectory( | 3536 https_server_example_domain_.ServeFilesFromSourceDirectory( |
3543 base::FilePath(kDocRoot)); | 3537 base::FilePath(kDocRoot)); |
3544 ASSERT_TRUE(https_server_example_domain_.Start()); | 3538 ASSERT_TRUE(https_server_example_domain_.Start()); |
3545 | 3539 |
3546 host_resolver()->AddRule( | |
3547 "mail.example.com", https_server_example_domain_.host_port_pair().host()); | |
3548 host_resolver()->AddRule( | |
3549 "www.mail.example.com", | |
3550 https_server_example_domain_.host_port_pair().host()); | |
3551 | |
3552 scoped_refptr<net::X509Certificate> cert = | 3540 scoped_refptr<net::X509Certificate> cert = |
3553 https_server_example_domain_.GetCertificate(); | 3541 https_server_example_domain_.GetCertificate(); |
3554 | 3542 |
3555 net::CertVerifyResult verify_result; | 3543 net::CertVerifyResult verify_result; |
3556 verify_result.verified_cert = | 3544 verify_result.verified_cert = |
3557 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); | 3545 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); |
3558 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; | 3546 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; |
3559 | 3547 |
3560 mock_cert_verifier()->AddResultForCertAndHost( | 3548 mock_cert_verifier()->AddResultForCertAndHost( |
3561 cert.get(), "www.mail.example.com", verify_result, | 3549 cert.get(), "www.mail.example.com", verify_result, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3605 // Same as above, but instead of stopping, the loading page is reloaded. The end | 3593 // Same as above, but instead of stopping, the loading page is reloaded. The end |
3606 // result is the same. (i.e. page load stops, no interstitials shown) | 3594 // result is the same. (i.e. page load stops, no interstitials shown) |
3607 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, | 3595 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, |
3608 InterstitialReloadNavigationWhileLoading) { | 3596 InterstitialReloadNavigationWhileLoading) { |
3609 net::EmbeddedTestServer https_server_example_domain_( | 3597 net::EmbeddedTestServer https_server_example_domain_( |
3610 net::EmbeddedTestServer::TYPE_HTTPS); | 3598 net::EmbeddedTestServer::TYPE_HTTPS); |
3611 https_server_example_domain_.ServeFilesFromSourceDirectory( | 3599 https_server_example_domain_.ServeFilesFromSourceDirectory( |
3612 base::FilePath(kDocRoot)); | 3600 base::FilePath(kDocRoot)); |
3613 ASSERT_TRUE(https_server_example_domain_.Start()); | 3601 ASSERT_TRUE(https_server_example_domain_.Start()); |
3614 | 3602 |
3615 host_resolver()->AddRule( | |
3616 "mail.example.com", https_server_example_domain_.host_port_pair().host()); | |
3617 host_resolver()->AddRule( | |
3618 "www.mail.example.com", | |
3619 https_server_example_domain_.host_port_pair().host()); | |
3620 | |
3621 scoped_refptr<net::X509Certificate> cert = | 3603 scoped_refptr<net::X509Certificate> cert = |
3622 https_server_example_domain_.GetCertificate(); | 3604 https_server_example_domain_.GetCertificate(); |
3623 | 3605 |
3624 net::CertVerifyResult verify_result; | 3606 net::CertVerifyResult verify_result; |
3625 verify_result.verified_cert = | 3607 verify_result.verified_cert = |
3626 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); | 3608 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); |
3627 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; | 3609 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; |
3628 | 3610 |
3629 mock_cert_verifier()->AddResultForCertAndHost( | 3611 mock_cert_verifier()->AddResultForCertAndHost( |
3630 cert.get(), "www.mail.example.com", verify_result, | 3612 cert.get(), "www.mail.example.com", verify_result, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3672 // Same as above, but instead of reloading, the page is navigated away. The | 3654 // Same as above, but instead of reloading, the page is navigated away. The |
3673 // new page should load, and no interstitials should be shown. | 3655 // new page should load, and no interstitials should be shown. |
3674 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, | 3656 IN_PROC_BROWSER_TEST_F(CommonNameMismatchBrowserTest, |
3675 InterstitialNavigateAwayWhileLoading) { | 3657 InterstitialNavigateAwayWhileLoading) { |
3676 net::EmbeddedTestServer https_server_example_domain_( | 3658 net::EmbeddedTestServer https_server_example_domain_( |
3677 net::EmbeddedTestServer::TYPE_HTTPS); | 3659 net::EmbeddedTestServer::TYPE_HTTPS); |
3678 https_server_example_domain_.ServeFilesFromSourceDirectory( | 3660 https_server_example_domain_.ServeFilesFromSourceDirectory( |
3679 base::FilePath(kDocRoot)); | 3661 base::FilePath(kDocRoot)); |
3680 ASSERT_TRUE(https_server_example_domain_.Start()); | 3662 ASSERT_TRUE(https_server_example_domain_.Start()); |
3681 | 3663 |
3682 host_resolver()->AddRule( | |
3683 "mail.example.com", https_server_example_domain_.host_port_pair().host()); | |
3684 host_resolver()->AddRule( | |
3685 "www.mail.example.com", | |
3686 https_server_example_domain_.host_port_pair().host()); | |
3687 | |
3688 scoped_refptr<net::X509Certificate> cert = | 3664 scoped_refptr<net::X509Certificate> cert = |
3689 https_server_example_domain_.GetCertificate(); | 3665 https_server_example_domain_.GetCertificate(); |
3690 | 3666 |
3691 net::CertVerifyResult verify_result; | 3667 net::CertVerifyResult verify_result; |
3692 verify_result.verified_cert = | 3668 verify_result.verified_cert = |
3693 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); | 3669 net::ImportCertFromFile(net::GetTestCertsDirectory(), "spdy_pooling.pem"); |
3694 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; | 3670 verify_result.cert_status = net::CERT_STATUS_COMMON_NAME_INVALID; |
3695 | 3671 |
3696 mock_cert_verifier()->AddResultForCertAndHost( | 3672 mock_cert_verifier()->AddResultForCertAndHost( |
3697 cert.get(), "www.mail.example.com", verify_result, | 3673 cert.get(), "www.mail.example.com", verify_result, |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4451 | 4427 |
4452 // Visit a page over https that contains a frame with a redirect. | 4428 // Visit a page over https that contains a frame with a redirect. |
4453 | 4429 |
4454 // XMLHttpRequest insecure content in synchronous mode. | 4430 // XMLHttpRequest insecure content in synchronous mode. |
4455 | 4431 |
4456 // XMLHttpRequest insecure content in asynchronous mode. | 4432 // XMLHttpRequest insecure content in asynchronous mode. |
4457 | 4433 |
4458 // XMLHttpRequest over bad ssl in synchronous mode. | 4434 // XMLHttpRequest over bad ssl in synchronous mode. |
4459 | 4435 |
4460 // XMLHttpRequest over OK ssl in synchronous mode. | 4436 // XMLHttpRequest over OK ssl in synchronous mode. |
OLD | NEW |