| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 certificate_reporting_test_utils::ExpectReport expect_report, | 461 certificate_reporting_test_utils::ExpectReport expect_report, |
| 462 Browser* browser) { | 462 Browser* browser) { |
| 463 base::RunLoop run_loop; | 463 base::RunLoop run_loop; |
| 464 ASSERT_TRUE(https_server_expired_.Start()); | 464 ASSERT_TRUE(https_server_expired_.Start()); |
| 465 | 465 |
| 466 ASSERT_NO_FATAL_FAILURE(SetUpMockReporter()); | 466 ASSERT_NO_FATAL_FAILURE(SetUpMockReporter()); |
| 467 | 467 |
| 468 // Opt in to sending reports for invalid certificate chains. | 468 // Opt in to sending reports for invalid certificate chains. |
| 469 certificate_reporting_test_utils::SetCertReportingOptIn(browser, opt_in); | 469 certificate_reporting_test_utils::SetCertReportingOptIn(browser, opt_in); |
| 470 | 470 |
| 471 ui_test_utils::NavigateToURL(browser, https_server_expired_.GetURL("/")); | 471 ui_test_utils::NavigateToURL(browser, |
| 472 https_server_expired_.GetURL("/title1.html")); |
| 472 | 473 |
| 473 WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); | 474 WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); |
| 474 ASSERT_TRUE(tab != nullptr); | 475 ASSERT_TRUE(tab != nullptr); |
| 475 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, | 476 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, |
| 476 AuthState::SHOWING_INTERSTITIAL); | 477 AuthState::SHOWING_INTERSTITIAL); |
| 477 | 478 |
| 478 std::unique_ptr<SSLCertReporter> ssl_cert_reporter = | 479 std::unique_ptr<SSLCertReporter> ssl_cert_reporter = |
| 479 certificate_reporting_test_utils::SetUpMockSSLCertReporter( | 480 certificate_reporting_test_utils::SetUpMockSSLCertReporter( |
| 480 &run_loop, expect_report); | 481 &run_loop, expect_report); |
| 481 | 482 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 495 // Click "Take me back" | 496 // Click "Take me back" |
| 496 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | 497 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
| 497 ASSERT_TRUE(interstitial_page); | 498 ASSERT_TRUE(interstitial_page); |
| 498 interstitial_page->DontProceed(); | 499 interstitial_page->DontProceed(); |
| 499 } | 500 } |
| 500 | 501 |
| 501 if (expect_report == | 502 if (expect_report == |
| 502 certificate_reporting_test_utils::CERT_REPORT_EXPECTED) { | 503 certificate_reporting_test_utils::CERT_REPORT_EXPECTED) { |
| 503 // Check that the mock reporter received a request to send a report. | 504 // Check that the mock reporter received a request to send a report. |
| 504 run_loop.Run(); | 505 run_loop.Run(); |
| 505 EXPECT_EQ(https_server_expired_.GetURL("/").host(), | 506 EXPECT_EQ(https_server_expired_.GetURL("/title1.html").host(), |
| 506 GetLatestHostnameReported()); | 507 GetLatestHostnameReported()); |
| 507 } else { | 508 } else { |
| 508 base::RunLoop().RunUntilIdle(); | 509 base::RunLoop().RunUntilIdle(); |
| 509 EXPECT_EQ(std::string(), GetLatestHostnameReported()); | 510 EXPECT_EQ(std::string(), GetLatestHostnameReported()); |
| 510 } | 511 } |
| 511 } | 512 } |
| 512 | 513 |
| 513 // Helper function for testing invalid certificate chain reporting with the | 514 // Helper function for testing invalid certificate chain reporting with the |
| 514 // bad clock interstitial. | 515 // bad clock interstitial. |
| 515 void TestBadClockReporting( | 516 void TestBadClockReporting( |
| 516 certificate_reporting_test_utils::OptIn opt_in, | 517 certificate_reporting_test_utils::OptIn opt_in, |
| 517 certificate_reporting_test_utils::ExpectReport expect_report, | 518 certificate_reporting_test_utils::ExpectReport expect_report, |
| 518 Browser* browser) { | 519 Browser* browser) { |
| 519 base::RunLoop run_loop; | 520 base::RunLoop run_loop; |
| 520 ASSERT_TRUE(https_server_expired_.Start()); | 521 ASSERT_TRUE(https_server_expired_.Start()); |
| 521 ASSERT_NO_FATAL_FAILURE(SetUpMockReporter()); | 522 ASSERT_NO_FATAL_FAILURE(SetUpMockReporter()); |
| 522 | 523 |
| 523 // Set network time back ten minutes, which is sufficient to | 524 // Set network time back ten minutes, which is sufficient to |
| 524 // trigger the reporting. | 525 // trigger the reporting. |
| 525 g_browser_process->network_time_tracker()->UpdateNetworkTime( | 526 g_browser_process->network_time_tracker()->UpdateNetworkTime( |
| 526 base::Time::Now() - base::TimeDelta::FromMinutes(10), | 527 base::Time::Now() - base::TimeDelta::FromMinutes(10), |
| 527 base::TimeDelta::FromMilliseconds(1), /* resolution */ | 528 base::TimeDelta::FromMilliseconds(1), /* resolution */ |
| 528 base::TimeDelta::FromMilliseconds(500), /* latency */ | 529 base::TimeDelta::FromMilliseconds(500), /* latency */ |
| 529 base::TimeTicks::Now() /* posting time of this update */); | 530 base::TimeTicks::Now() /* posting time of this update */); |
| 530 | 531 |
| 531 // Opt in to sending reports for invalid certificate chains. | 532 // Opt in to sending reports for invalid certificate chains. |
| 532 certificate_reporting_test_utils::SetCertReportingOptIn(browser, opt_in); | 533 certificate_reporting_test_utils::SetCertReportingOptIn(browser, opt_in); |
| 533 | 534 |
| 534 ui_test_utils::NavigateToURL(browser, https_server_expired_.GetURL("/")); | 535 ui_test_utils::NavigateToURL(browser, |
| 536 https_server_expired_.GetURL("/title1.html")); |
| 535 | 537 |
| 536 WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); | 538 WebContents* tab = browser->tab_strip_model()->GetActiveWebContents(); |
| 537 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, | 539 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_DATE_INVALID, |
| 538 AuthState::SHOWING_INTERSTITIAL); | 540 AuthState::SHOWING_INTERSTITIAL); |
| 539 | 541 |
| 540 std::unique_ptr<SSLCertReporter> ssl_cert_reporter = | 542 std::unique_ptr<SSLCertReporter> ssl_cert_reporter = |
| 541 certificate_reporting_test_utils::SetUpMockSSLCertReporter( | 543 certificate_reporting_test_utils::SetUpMockSSLCertReporter( |
| 542 &run_loop, expect_report); | 544 &run_loop, expect_report); |
| 543 | 545 |
| 544 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | 546 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); |
| 545 ASSERT_EQ(BadClockBlockingPage::kTypeForTesting, | 547 ASSERT_EQ(BadClockBlockingPage::kTypeForTesting, |
| 546 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); | 548 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); |
| 547 BadClockBlockingPage* clock_page = static_cast<BadClockBlockingPage*>( | 549 BadClockBlockingPage* clock_page = static_cast<BadClockBlockingPage*>( |
| 548 tab->GetInterstitialPage()->GetDelegateForTesting()); | 550 tab->GetInterstitialPage()->GetDelegateForTesting()); |
| 549 clock_page->SetSSLCertReporterForTesting(std::move(ssl_cert_reporter)); | 551 clock_page->SetSSLCertReporterForTesting(std::move(ssl_cert_reporter)); |
| 550 | 552 |
| 551 EXPECT_EQ(std::string(), GetLatestHostnameReported()); | 553 EXPECT_EQ(std::string(), GetLatestHostnameReported()); |
| 552 | 554 |
| 553 interstitial_page->DontProceed(); | 555 interstitial_page->DontProceed(); |
| 554 | 556 |
| 555 if (expect_report == | 557 if (expect_report == |
| 556 certificate_reporting_test_utils::CERT_REPORT_EXPECTED) { | 558 certificate_reporting_test_utils::CERT_REPORT_EXPECTED) { |
| 557 // Check that the mock reporter received a request to send a report. | 559 // Check that the mock reporter received a request to send a report. |
| 558 run_loop.Run(); | 560 run_loop.Run(); |
| 559 EXPECT_EQ(https_server_expired_.GetURL("/").host(), | 561 EXPECT_EQ(https_server_expired_.GetURL("/title1.html").host(), |
| 560 GetLatestHostnameReported()); | 562 GetLatestHostnameReported()); |
| 561 } else { | 563 } else { |
| 562 base::RunLoop().RunUntilIdle(); | 564 base::RunLoop().RunUntilIdle(); |
| 563 EXPECT_EQ(std::string(), GetLatestHostnameReported()); | 565 EXPECT_EQ(std::string(), GetLatestHostnameReported()); |
| 564 } | 566 } |
| 565 } | 567 } |
| 566 | 568 |
| 567 net::EmbeddedTestServer https_server_; | 569 net::EmbeddedTestServer https_server_; |
| 568 net::EmbeddedTestServer https_server_expired_; | 570 net::EmbeddedTestServer https_server_expired_; |
| 569 net::EmbeddedTestServer https_server_mismatched_; | 571 net::EmbeddedTestServer https_server_mismatched_; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 const std::string decision_histogram = | 704 const std::string decision_histogram = |
| 703 "interstitial.ssl_overridable.decision"; | 705 "interstitial.ssl_overridable.decision"; |
| 704 const std::string interaction_histogram = | 706 const std::string interaction_histogram = |
| 705 "interstitial.ssl_overridable.interaction"; | 707 "interstitial.ssl_overridable.interaction"; |
| 706 | 708 |
| 707 // Histograms should start off empty. | 709 // Histograms should start off empty. |
| 708 histograms.ExpectTotalCount(decision_histogram, 0); | 710 histograms.ExpectTotalCount(decision_histogram, 0); |
| 709 histograms.ExpectTotalCount(interaction_histogram, 0); | 711 histograms.ExpectTotalCount(interaction_histogram, 0); |
| 710 | 712 |
| 711 // After navigating to the page, the totals should be set. | 713 // After navigating to the page, the totals should be set. |
| 712 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); | 714 ui_test_utils::NavigateToURL(browser(), |
| 715 https_server_expired_.GetURL("/title1.html")); |
| 713 content::WaitForInterstitialAttach( | 716 content::WaitForInterstitialAttach( |
| 714 browser()->tab_strip_model()->GetActiveWebContents()); | 717 browser()->tab_strip_model()->GetActiveWebContents()); |
| 715 histograms.ExpectTotalCount(decision_histogram, 1); | 718 histograms.ExpectTotalCount(decision_histogram, 1); |
| 716 histograms.ExpectBucketCount(decision_histogram, | 719 histograms.ExpectBucketCount(decision_histogram, |
| 717 security_interstitials::MetricsHelper::SHOW, 1); | 720 security_interstitials::MetricsHelper::SHOW, 1); |
| 718 histograms.ExpectTotalCount(interaction_histogram, 1); | 721 histograms.ExpectTotalCount(interaction_histogram, 1); |
| 719 histograms.ExpectBucketCount( | 722 histograms.ExpectBucketCount( |
| 720 interaction_histogram, | 723 interaction_histogram, |
| 721 security_interstitials::MetricsHelper::TOTAL_VISITS, 1); | 724 security_interstitials::MetricsHelper::TOTAL_VISITS, 1); |
| 722 | 725 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 739 const std::string decision_histogram = | 742 const std::string decision_histogram = |
| 740 "interstitial.ssl_overridable.decision"; | 743 "interstitial.ssl_overridable.decision"; |
| 741 const std::string interaction_histogram = | 744 const std::string interaction_histogram = |
| 742 "interstitial.ssl_overridable.interaction"; | 745 "interstitial.ssl_overridable.interaction"; |
| 743 | 746 |
| 744 // Histograms should start off empty. | 747 // Histograms should start off empty. |
| 745 histograms.ExpectTotalCount(decision_histogram, 0); | 748 histograms.ExpectTotalCount(decision_histogram, 0); |
| 746 histograms.ExpectTotalCount(interaction_histogram, 0); | 749 histograms.ExpectTotalCount(interaction_histogram, 0); |
| 747 | 750 |
| 748 // After navigating to the page, the totals should be set. | 751 // After navigating to the page, the totals should be set. |
| 749 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); | 752 ui_test_utils::NavigateToURL(browser(), |
| 753 https_server_expired_.GetURL("/title1.html")); |
| 750 content::WaitForInterstitialAttach( | 754 content::WaitForInterstitialAttach( |
| 751 browser()->tab_strip_model()->GetActiveWebContents()); | 755 browser()->tab_strip_model()->GetActiveWebContents()); |
| 752 histograms.ExpectTotalCount(decision_histogram, 1); | 756 histograms.ExpectTotalCount(decision_histogram, 1); |
| 753 histograms.ExpectBucketCount(decision_histogram, | 757 histograms.ExpectBucketCount(decision_histogram, |
| 754 security_interstitials::MetricsHelper::SHOW, 1); | 758 security_interstitials::MetricsHelper::SHOW, 1); |
| 755 histograms.ExpectTotalCount(interaction_histogram, 1); | 759 histograms.ExpectTotalCount(interaction_histogram, 1); |
| 756 histograms.ExpectBucketCount( | 760 histograms.ExpectBucketCount( |
| 757 interaction_histogram, | 761 interaction_histogram, |
| 758 security_interstitials::MetricsHelper::TOTAL_VISITS, 1); | 762 security_interstitials::MetricsHelper::TOTAL_VISITS, 1); |
| 759 | 763 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 ASSERT_TRUE(https_server_expired_.Start()); | 893 ASSERT_TRUE(https_server_expired_.Start()); |
| 890 | 894 |
| 891 // Set up the build and current clock times to be more than a year apart. | 895 // Set up the build and current clock times to be more than a year apart. |
| 892 std::unique_ptr<base::SimpleTestClock> mock_clock( | 896 std::unique_ptr<base::SimpleTestClock> mock_clock( |
| 893 new base::SimpleTestClock()); | 897 new base::SimpleTestClock()); |
| 894 mock_clock->SetNow(base::Time::NowFromSystemTime()); | 898 mock_clock->SetNow(base::Time::NowFromSystemTime()); |
| 895 mock_clock->Advance(base::TimeDelta::FromDays(367)); | 899 mock_clock->Advance(base::TimeDelta::FromDays(367)); |
| 896 SSLErrorHandler::SetClockForTest(mock_clock.get()); | 900 SSLErrorHandler::SetClockForTest(mock_clock.get()); |
| 897 ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime()); | 901 ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime()); |
| 898 | 902 |
| 899 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); | 903 ui_test_utils::NavigateToURL(browser(), |
| 904 https_server_expired_.GetURL("/title1.html")); |
| 900 WebContents* clock_tab = browser()->tab_strip_model()->GetActiveWebContents(); | 905 WebContents* clock_tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 901 content::WaitForInterstitialAttach(clock_tab); | 906 content::WaitForInterstitialAttach(clock_tab); |
| 902 InterstitialPage* clock_interstitial = clock_tab->GetInterstitialPage(); | 907 InterstitialPage* clock_interstitial = clock_tab->GetInterstitialPage(); |
| 903 ASSERT_TRUE(clock_interstitial); | 908 ASSERT_TRUE(clock_interstitial); |
| 904 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, | 909 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, |
| 905 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); | 910 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); |
| 906 } | 911 } |
| 907 | 912 |
| 908 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorCausedByClockUsingNetwork) { | 913 IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSErrorCausedByClockUsingNetwork) { |
| 909 ASSERT_TRUE(https_server_expired_.Start()); | 914 ASSERT_TRUE(https_server_expired_.Start()); |
| 910 | 915 |
| 911 // Set network forward ten minutes, which is sufficient to trigger | 916 // Set network forward ten minutes, which is sufficient to trigger |
| 912 // the interstitial. | 917 // the interstitial. |
| 913 g_browser_process->network_time_tracker()->UpdateNetworkTime( | 918 g_browser_process->network_time_tracker()->UpdateNetworkTime( |
| 914 base::Time::Now() + base::TimeDelta::FromMinutes(10), | 919 base::Time::Now() + base::TimeDelta::FromMinutes(10), |
| 915 base::TimeDelta::FromMilliseconds(1), /* resolution */ | 920 base::TimeDelta::FromMilliseconds(1), /* resolution */ |
| 916 base::TimeDelta::FromMilliseconds(500), /* latency */ | 921 base::TimeDelta::FromMilliseconds(500), /* latency */ |
| 917 base::TimeTicks::Now() /* posting time of this update */); | 922 base::TimeTicks::Now() /* posting time of this update */); |
| 918 | 923 |
| 919 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); | 924 ui_test_utils::NavigateToURL(browser(), |
| 925 https_server_expired_.GetURL("/title1.html")); |
| 920 WebContents* clock_tab = browser()->tab_strip_model()->GetActiveWebContents(); | 926 WebContents* clock_tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 921 content::WaitForInterstitialAttach(clock_tab); | 927 content::WaitForInterstitialAttach(clock_tab); |
| 922 InterstitialPage* clock_interstitial = clock_tab->GetInterstitialPage(); | 928 InterstitialPage* clock_interstitial = clock_tab->GetInterstitialPage(); |
| 923 ASSERT_TRUE(clock_interstitial); | 929 ASSERT_TRUE(clock_interstitial); |
| 924 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, | 930 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, |
| 925 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); | 931 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); |
| 926 } | 932 } |
| 927 | 933 |
| 928 // Visits a page with https error and then goes back using Browser::GoBack. | 934 // Visits a page with https error and then goes back using Browser::GoBack. |
| 929 IN_PROC_BROWSER_TEST_F(SSLUITest, | 935 IN_PROC_BROWSER_TEST_F(SSLUITest, |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1310 // We should have an interstitial page showing. | 1316 // We should have an interstitial page showing. |
| 1311 ASSERT_TRUE(tab2->GetInterstitialPage()); | 1317 ASSERT_TRUE(tab2->GetInterstitialPage()); |
| 1312 ASSERT_EQ(SSLBlockingPage::kTypeForTesting, tab2->GetInterstitialPage() | 1318 ASSERT_EQ(SSLBlockingPage::kTypeForTesting, tab2->GetInterstitialPage() |
| 1313 ->GetDelegateForTesting() | 1319 ->GetDelegateForTesting() |
| 1314 ->GetTypeForTesting()); | 1320 ->GetTypeForTesting()); |
| 1315 } | 1321 } |
| 1316 | 1322 |
| 1317 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) { | 1323 IN_PROC_BROWSER_TEST_F(SSLUITest, TestBadHTTPSDownload) { |
| 1318 ASSERT_TRUE(embedded_test_server()->Start()); | 1324 ASSERT_TRUE(embedded_test_server()->Start()); |
| 1319 ASSERT_TRUE(https_server_expired_.Start()); | 1325 ASSERT_TRUE(https_server_expired_.Start()); |
| 1320 GURL url_non_dangerous = embedded_test_server()->GetURL("/"); | 1326 GURL url_non_dangerous = embedded_test_server()->GetURL("/title1.html"); |
| 1321 GURL url_dangerous = | 1327 GURL url_dangerous = |
| 1322 https_server_expired_.GetURL("/downloads/dangerous/dangerous.exe"); | 1328 https_server_expired_.GetURL("/downloads/dangerous/dangerous.exe"); |
| 1323 base::ScopedTempDir downloads_directory_; | 1329 base::ScopedTempDir downloads_directory_; |
| 1324 | 1330 |
| 1325 // Need empty temp dir to avoid having Chrome ask us for a new filename | 1331 // Need empty temp dir to avoid having Chrome ask us for a new filename |
| 1326 // when we've downloaded dangerous.exe one hundred times. | 1332 // when we've downloaded dangerous.exe one hundred times. |
| 1327 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); | 1333 ASSERT_TRUE(downloads_directory_.CreateUniqueTempDir()); |
| 1328 | 1334 |
| 1329 browser()->profile()->GetPrefs()->SetFilePath( | 1335 browser()->profile()->GetPrefs()->SetFilePath( |
| 1330 prefs::kDownloadDefaultDirectory, | 1336 prefs::kDownloadDefaultDirectory, |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 #else | 1611 #else |
| 1606 #define MAYBE_TestDisplaysInsecureContentLoadedFromJS \ | 1612 #define MAYBE_TestDisplaysInsecureContentLoadedFromJS \ |
| 1607 TestDisplaysInsecureContentLoadedFromJS | 1613 TestDisplaysInsecureContentLoadedFromJS |
| 1608 #endif | 1614 #endif |
| 1609 IN_PROC_BROWSER_TEST_F(SSLUITest, | 1615 IN_PROC_BROWSER_TEST_F(SSLUITest, |
| 1610 MAYBE_TestDisplaysInsecureContentLoadedFromJS) { | 1616 MAYBE_TestDisplaysInsecureContentLoadedFromJS) { |
| 1611 ASSERT_TRUE(embedded_test_server()->Start()); | 1617 ASSERT_TRUE(embedded_test_server()->Start()); |
| 1612 ASSERT_TRUE(https_server_.Start()); | 1618 ASSERT_TRUE(https_server_.Start()); |
| 1613 | 1619 |
| 1614 host_resolver()->AddRule("example.test", | 1620 host_resolver()->AddRule("example.test", |
| 1615 https_server_.GetURL("/").host()); | 1621 https_server_.GetURL("/title1.html").host()); |
| 1616 | 1622 |
| 1617 net::HostPortPair replacement_pair = embedded_test_server()->host_port_pair(); | 1623 net::HostPortPair replacement_pair = embedded_test_server()->host_port_pair(); |
| 1618 replacement_pair.set_host("example.test"); | 1624 replacement_pair.set_host("example.test"); |
| 1619 | 1625 |
| 1620 std::string replacement_path; | 1626 std::string replacement_path; |
| 1621 GetFilePathWithHostAndPortReplacement( | 1627 GetFilePathWithHostAndPortReplacement( |
| 1622 "/ssl/page_with_dynamic_insecure_content.html", | 1628 "/ssl/page_with_dynamic_insecure_content.html", |
| 1623 replacement_pair, &replacement_path); | 1629 replacement_pair, &replacement_path); |
| 1624 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( | 1630 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( |
| 1625 replacement_path)); | 1631 replacement_path)); |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2585 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2591 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 2586 ASSERT_TRUE(tab); | 2592 ASSERT_TRUE(tab); |
| 2587 | 2593 |
| 2588 // Set up the build and current clock times to be more than a year apart. | 2594 // Set up the build and current clock times to be more than a year apart. |
| 2589 base::SimpleTestClock mock_clock; | 2595 base::SimpleTestClock mock_clock; |
| 2590 mock_clock.SetNow(base::Time::NowFromSystemTime()); | 2596 mock_clock.SetNow(base::Time::NowFromSystemTime()); |
| 2591 mock_clock.Advance(base::TimeDelta::FromDays(367)); | 2597 mock_clock.Advance(base::TimeDelta::FromDays(367)); |
| 2592 SSLErrorHandler::SetClockForTest(&mock_clock); | 2598 SSLErrorHandler::SetClockForTest(&mock_clock); |
| 2593 ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime()); | 2599 ssl_errors::SetBuildTimeForTesting(base::Time::NowFromSystemTime()); |
| 2594 | 2600 |
| 2595 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); | 2601 ui_test_utils::NavigateToURL(browser(), |
| 2602 https_server_expired_.GetURL("/title1.html")); |
| 2596 content::WaitForInterstitialAttach(tab); | 2603 content::WaitForInterstitialAttach(tab); |
| 2597 InterstitialPage* clock_interstitial = tab->GetInterstitialPage(); | 2604 InterstitialPage* clock_interstitial = tab->GetInterstitialPage(); |
| 2598 ASSERT_TRUE(clock_interstitial); | 2605 ASSERT_TRUE(clock_interstitial); |
| 2599 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, | 2606 EXPECT_EQ(BadClockBlockingPage::kTypeForTesting, |
| 2600 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); | 2607 clock_interstitial->GetDelegateForTesting()->GetTypeForTesting()); |
| 2601 | 2608 |
| 2602 // Grab the SSLStatus on the clock interstitial. | 2609 // Grab the SSLStatus on the clock interstitial. |
| 2603 content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); | 2610 content::NavigationEntry* entry = tab->GetController().GetActiveEntry(); |
| 2604 ASSERT_TRUE(entry); | 2611 ASSERT_TRUE(entry); |
| 2605 content::SSLStatus clock_interstitial_ssl_status = entry->GetSSL(); | 2612 content::SSLStatus clock_interstitial_ssl_status = entry->GetSSL(); |
| 2606 | 2613 |
| 2607 // Put the clock back to normal, trigger a normal SSL interstitial, | 2614 // Put the clock back to normal, trigger a normal SSL interstitial, |
| 2608 // and proceed through it. | 2615 // and proceed through it. |
| 2609 mock_clock.SetNow(base::Time::NowFromSystemTime()); | 2616 mock_clock.SetNow(base::Time::NowFromSystemTime()); |
| 2610 ui_test_utils::NavigateToURL(browser(), https_server_expired_.GetURL("/")); | 2617 ui_test_utils::NavigateToURL(browser(), |
| 2618 https_server_expired_.GetURL("/title1.html")); |
| 2611 content::WaitForInterstitialAttach(tab); | 2619 content::WaitForInterstitialAttach(tab); |
| 2612 InterstitialPage* ssl_interstitial = tab->GetInterstitialPage(); | 2620 InterstitialPage* ssl_interstitial = tab->GetInterstitialPage(); |
| 2613 ASSERT_TRUE(ssl_interstitial); | 2621 ASSERT_TRUE(ssl_interstitial); |
| 2614 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, | 2622 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, |
| 2615 ssl_interstitial->GetDelegateForTesting()->GetTypeForTesting()); | 2623 ssl_interstitial->GetDelegateForTesting()->GetTypeForTesting()); |
| 2616 ProceedThroughInterstitial(tab); | 2624 ProceedThroughInterstitial(tab); |
| 2617 EXPECT_FALSE(tab->ShowingInterstitialPage()); | 2625 EXPECT_FALSE(tab->ShowingInterstitialPage()); |
| 2618 | 2626 |
| 2619 // Grab the SSLStatus from the page and check that it is the same as | 2627 // Grab the SSLStatus from the page and check that it is the same as |
| 2620 // on the clock interstitial. | 2628 // on the clock interstitial. |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2997 | 3005 |
| 2998 // Visit a page over https that contains a frame with a redirect. | 3006 // Visit a page over https that contains a frame with a redirect. |
| 2999 | 3007 |
| 3000 // XMLHttpRequest insecure content in synchronous mode. | 3008 // XMLHttpRequest insecure content in synchronous mode. |
| 3001 | 3009 |
| 3002 // XMLHttpRequest insecure content in asynchronous mode. | 3010 // XMLHttpRequest insecure content in asynchronous mode. |
| 3003 | 3011 |
| 3004 // XMLHttpRequest over bad ssl in synchronous mode. | 3012 // XMLHttpRequest over bad ssl in synchronous mode. |
| 3005 | 3013 |
| 3006 // XMLHttpRequest over OK ssl in synchronous mode. | 3014 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |