Chromium Code Reviews| 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/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/base_switches.h" | 8 #include "base/base_switches.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 #include "chrome/browser/ssl/bad_clock_blocking_page.h" | 38 #include "chrome/browser/ssl/bad_clock_blocking_page.h" |
| 39 #include "chrome/browser/ssl/cert_report_helper.h" | 39 #include "chrome/browser/ssl/cert_report_helper.h" |
| 40 #include "chrome/browser/ssl/cert_verifier_browser_test.h" | 40 #include "chrome/browser/ssl/cert_verifier_browser_test.h" |
| 41 #include "chrome/browser/ssl/certificate_reporting_test_utils.h" | 41 #include "chrome/browser/ssl/certificate_reporting_test_utils.h" |
| 42 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" | 42 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
| 43 #include "chrome/browser/ssl/common_name_mismatch_handler.h" | 43 #include "chrome/browser/ssl/common_name_mismatch_handler.h" |
| 44 #include "chrome/browser/ssl/security_state_tab_helper.h" | 44 #include "chrome/browser/ssl/security_state_tab_helper.h" |
| 45 #include "chrome/browser/ssl/ssl_blocking_page.h" | 45 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 46 #include "chrome/browser/ssl/ssl_error_assistant.pb.h" | 46 #include "chrome/browser/ssl/ssl_error_assistant.pb.h" |
| 47 #include "chrome/browser/ssl/ssl_error_handler.h" | 47 #include "chrome/browser/ssl/ssl_error_handler.h" |
| 48 #include "chrome/browser/ssl/superfish_blocking_page.h" | |
| 48 #include "chrome/browser/ui/browser.h" | 49 #include "chrome/browser/ui/browser.h" |
| 49 #include "chrome/browser/ui/browser_commands.h" | 50 #include "chrome/browser/ui/browser_commands.h" |
| 50 #include "chrome/browser/ui/browser_finder.h" | 51 #include "chrome/browser/ui/browser_finder.h" |
| 51 #include "chrome/browser/ui/browser_navigator.h" | 52 #include "chrome/browser/ui/browser_navigator.h" |
| 52 #include "chrome/browser/ui/browser_navigator_params.h" | 53 #include "chrome/browser/ui/browser_navigator_params.h" |
| 53 #include "chrome/browser/ui/browser_tabstrip.h" | 54 #include "chrome/browser/ui/browser_tabstrip.h" |
| 54 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 55 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 55 #include "chrome/common/chrome_paths.h" | 56 #include "chrome/common/chrome_paths.h" |
| 56 #include "chrome/common/chrome_switches.h" | 57 #include "chrome/common/chrome_switches.h" |
| 57 #include "chrome/common/pref_names.h" | 58 #include "chrome/common/pref_names.h" |
| (...skipping 4687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4745 // certificate is not present. | 4746 // certificate is not present. |
| 4746 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, NoSuperfishRecorded) { | 4747 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, NoSuperfishRecorded) { |
| 4747 SetUpCertVerifier(false /* use superfish cert */); | 4748 SetUpCertVerifier(false /* use superfish cert */); |
| 4748 GURL url(https_server_.GetURL("/ssl/google.html")); | 4749 GURL url(https_server_.GetURL("/ssl/google.html")); |
| 4749 base::HistogramTester histograms; | 4750 base::HistogramTester histograms; |
| 4750 ui_test_utils::NavigateToURL(browser(), url); | 4751 ui_test_utils::NavigateToURL(browser(), url); |
| 4751 histograms.ExpectUniqueSample("interstitial.ssl_error_handler.superfish", | 4752 histograms.ExpectUniqueSample("interstitial.ssl_error_handler.superfish", |
| 4752 false, 1); | 4753 false, 1); |
| 4753 } | 4754 } |
| 4754 | 4755 |
| 4756 // Tests that the Superfish interstitial is shown when the Finch feature is | |
| 4757 // enabled and the Superfish certificate is present. | |
| 4758 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitial) { | |
| 4759 base::test::ScopedFeatureList scoped_feature_list; | |
| 4760 scoped_feature_list.InitFromCommandLine("SuperfishInterstitial", | |
| 4761 std::string()); | |
| 4762 SetUpCertVerifier(true /* use superfish cert */); | |
| 4763 GURL url(https_server_.GetURL("/ssl/google.html")); | |
|
meacer
2017/06/22 19:06:18
nit: const
estark
2017/06/22 22:01:05
inlined instead
| |
| 4764 ui_test_utils::NavigateToURL(browser(), url); | |
| 4765 content::WebContents* tab = | |
| 4766 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 4767 content::WaitForInterstitialAttach(tab); | |
| 4768 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | |
| 4769 ASSERT_TRUE(interstitial_page); | |
| 4770 EXPECT_EQ(SuperfishBlockingPage::kTypeForTesting, | |
| 4771 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); | |
| 4772 } | |
| 4773 | |
| 4774 // Tests that the Superfish interstitial is not shown when the Finch feature is | |
| 4775 // disabled. | |
| 4776 IN_PROC_BROWSER_TEST_F(SuperfishSSLUITest, SuperfishInterstitialDisabled) { | |
| 4777 base::test::ScopedFeatureList scoped_feature_list; | |
| 4778 scoped_feature_list.InitFromCommandLine(std::string(), | |
| 4779 "SuperfishInterstitial"); | |
| 4780 SetUpCertVerifier(true /* use superfish cert */); | |
| 4781 GURL url(https_server_.GetURL("/ssl/google.html")); | |
|
meacer
2017/06/22 19:06:18
const
estark
2017/06/22 22:01:05
ditto
| |
| 4782 ui_test_utils::NavigateToURL(browser(), url); | |
| 4783 content::WebContents* tab = | |
| 4784 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 4785 content::WaitForInterstitialAttach(tab); | |
| 4786 InterstitialPage* interstitial_page = tab->GetInterstitialPage(); | |
| 4787 ASSERT_TRUE(interstitial_page); | |
| 4788 EXPECT_EQ(SSLBlockingPage::kTypeForTesting, | |
| 4789 interstitial_page->GetDelegateForTesting()->GetTypeForTesting()); | |
| 4790 } | |
| 4791 | |
| 4755 // TODO(jcampan): more tests to do below. | 4792 // TODO(jcampan): more tests to do below. |
| 4756 | 4793 |
| 4757 // Visit a page over https that contains a frame with a redirect. | 4794 // Visit a page over https that contains a frame with a redirect. |
| 4758 | 4795 |
| 4759 // XMLHttpRequest insecure content in synchronous mode. | 4796 // XMLHttpRequest insecure content in synchronous mode. |
| 4760 | 4797 |
| 4761 // XMLHttpRequest insecure content in asynchronous mode. | 4798 // XMLHttpRequest insecure content in asynchronous mode. |
| 4762 | 4799 |
| 4763 // XMLHttpRequest over bad ssl in synchronous mode. | 4800 // XMLHttpRequest over bad ssl in synchronous mode. |
| 4764 | 4801 |
| 4765 // XMLHttpRequest over OK ssl in synchronous mode. | 4802 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |