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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 29 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" | 29 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" |
| 30 #include "chrome/browser/ssl/ssl_blocking_page.h" | 30 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| 31 #include "chrome/browser/ui/browser.h" | 31 #include "chrome/browser/ui/browser.h" |
| 32 #include "chrome/browser/ui/browser_commands.h" | 32 #include "chrome/browser/ui/browser_commands.h" |
| 33 #include "chrome/browser/ui/browser_navigator.h" | 33 #include "chrome/browser/ui/browser_navigator.h" |
| 34 #include "chrome/browser/ui/browser_tabstrip.h" | 34 #include "chrome/browser/ui/browser_tabstrip.h" |
| 35 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 35 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 36 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
| 37 #include "chrome/common/chrome_switches.h" | 37 #include "chrome/common/chrome_switches.h" |
| 38 #include "chrome/common/pref_names.h" | 38 #include "chrome/common/pref_names.h" |
| 39 #include "chrome/test/base/cert_verifier_browser_test.h" | |
| 39 #include "chrome/test/base/in_process_browser_test.h" | 40 #include "chrome/test/base/in_process_browser_test.h" |
| 40 #include "chrome/test/base/ui_test_utils.h" | 41 #include "chrome/test/base/ui_test_utils.h" |
| 41 #include "components/content_settings/core/browser/host_content_settings_map.h" | 42 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 42 #include "components/security_interstitials/core/metrics_helper.h" | 43 #include "components/security_interstitials/core/metrics_helper.h" |
| 43 #include "components/variations/variations_associated_data.h" | 44 #include "components/variations/variations_associated_data.h" |
| 44 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 45 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 45 #include "content/public/browser/browser_context.h" | 46 #include "content/public/browser/browser_context.h" |
| 46 #include "content/public/browser/interstitial_page.h" | 47 #include "content/public/browser/interstitial_page.h" |
| 47 #include "content/public/browser/navigation_controller.h" | 48 #include "content/public/browser/navigation_controller.h" |
| 48 #include "content/public/browser/navigation_entry.h" | 49 #include "content/public/browser/navigation_entry.h" |
| 49 #include "content/public/browser/notification_service.h" | 50 #include "content/public/browser/notification_service.h" |
| 50 #include "content/public/browser/render_frame_host.h" | 51 #include "content/public/browser/render_frame_host.h" |
| 51 #include "content/public/browser/render_view_host.h" | 52 #include "content/public/browser/render_view_host.h" |
| 52 #include "content/public/browser/render_widget_host_view.h" | 53 #include "content/public/browser/render_widget_host_view.h" |
| 53 #include "content/public/browser/web_contents.h" | 54 #include "content/public/browser/web_contents.h" |
| 54 #include "content/public/browser/web_contents_observer.h" | 55 #include "content/public/browser/web_contents_observer.h" |
| 55 #include "content/public/common/security_style.h" | 56 #include "content/public/common/security_style.h" |
| 56 #include "content/public/common/ssl_status.h" | 57 #include "content/public/common/ssl_status.h" |
| 57 #include "content/public/test/browser_test_utils.h" | 58 #include "content/public/test/browser_test_utils.h" |
| 58 #include "content/public/test/download_test_observer.h" | 59 #include "content/public/test/download_test_observer.h" |
| 59 #include "content/public/test/test_renderer_host.h" | 60 #include "content/public/test/test_renderer_host.h" |
| 60 #include "net/base/host_port_pair.h" | 61 #include "net/base/host_port_pair.h" |
| 61 #include "net/base/net_errors.h" | 62 #include "net/base/net_errors.h" |
| 62 #include "net/base/test_data_directory.h" | 63 #include "net/base/test_data_directory.h" |
| 63 #include "net/cert/cert_status_flags.h" | 64 #include "net/cert/cert_status_flags.h" |
| 65 #include "net/cert/mock_cert_verifier.h" | |
| 64 #include "net/cert/x509_certificate.h" | 66 #include "net/cert/x509_certificate.h" |
| 65 #include "net/ssl/ssl_info.h" | 67 #include "net/ssl/ssl_info.h" |
| 66 #include "net/test/spawned_test_server/spawned_test_server.h" | 68 #include "net/test/spawned_test_server/spawned_test_server.h" |
| 67 #include "net/url_request/url_request_context.h" | 69 #include "net/url_request/url_request_context.h" |
| 68 | 70 |
| 69 #if defined(USE_NSS_CERTS) | 71 #if defined(USE_NSS_CERTS) |
| 70 #include "chrome/browser/net/nss_context.h" | 72 #include "chrome/browser/net/nss_context.h" |
| 71 #include "net/base/crypto_module.h" | 73 #include "net/base/crypto_module.h" |
| 72 #include "net/cert/nss_cert_database.h" | 74 #include "net/cert/nss_cert_database.h" |
| 73 #endif // defined(USE_NSS_CERTS) | 75 #endif // defined(USE_NSS_CERTS) |
| (...skipping 2199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2273 return new SSLBlockingPage( | 2275 return new SSLBlockingPage( |
| 2274 contents, net::ERR_CERT_CONTAINS_ERRORS, ssl_info, request_url, 0, | 2276 contents, net::ERR_CERT_CONTAINS_ERRORS, ssl_info, request_url, 0, |
| 2275 base::Time::NowFromSystemTime(), nullptr, base::Callback<void(bool)>()); | 2277 base::Time::NowFromSystemTime(), nullptr, base::Callback<void(bool)>()); |
| 2276 } | 2278 } |
| 2277 }; | 2279 }; |
| 2278 | 2280 |
| 2279 IN_PROC_BROWSER_TEST_F(SSLBlockingPageIDNTest, SSLBlockingPageDecodesIDN) { | 2281 IN_PROC_BROWSER_TEST_F(SSLBlockingPageIDNTest, SSLBlockingPageDecodesIDN) { |
| 2280 EXPECT_TRUE(VerifyIDNDecoded()); | 2282 EXPECT_TRUE(VerifyIDNDecoded()); |
| 2281 } | 2283 } |
| 2282 | 2284 |
| 2285 IN_PROC_BROWSER_TEST_F(CertVerifierBrowserTest, MockCertVerifierSmokeTest) { | |
| 2286 net::SpawnedTestServer https_server( | |
| 2287 net::SpawnedTestServer::TYPE_HTTPS, | |
| 2288 net::SpawnedTestServer::SSLOptions( | |
| 2289 net::SpawnedTestServer::SSLOptions::CERT_OK), | |
| 2290 base::FilePath(kDocRoot)); | |
| 2291 ASSERT_TRUE(https_server.Start()); | |
| 2292 | |
| 2293 mock_cert_verifier()->set_default_result(net::ERR_CERT_DATE_INVALID); | |
|
Ryan Sleevi
2015/08/04 18:24:34
nit: I'm slightly paranoid of date-based error cod
estark
2015/08/04 19:32:19
Done.
| |
| 2294 | |
| 2295 ui_test_utils::NavigateToURL(browser(), | |
| 2296 https_server.GetURL("files/ssl/google.html")); | |
| 2297 | |
| 2298 CheckSecurityState(browser()->tab_strip_model()->GetActiveWebContents(), | |
| 2299 net::CERT_STATUS_DATE_INVALID, | |
| 2300 content::SECURITY_STYLE_AUTHENTICATION_BROKEN, | |
| 2301 AuthState::SHOWING_INTERSTITIAL); | |
| 2302 } | |
| 2303 | |
| 2283 // TODO(jcampan): more tests to do below. | 2304 // TODO(jcampan): more tests to do below. |
| 2284 | 2305 |
| 2285 // Visit a page over https that contains a frame with a redirect. | 2306 // Visit a page over https that contains a frame with a redirect. |
| 2286 | 2307 |
| 2287 // XMLHttpRequest insecure content in synchronous mode. | 2308 // XMLHttpRequest insecure content in synchronous mode. |
| 2288 | 2309 |
| 2289 // XMLHttpRequest insecure content in asynchronous mode. | 2310 // XMLHttpRequest insecure content in asynchronous mode. |
| 2290 | 2311 |
| 2291 // XMLHttpRequest over bad ssl in synchronous mode. | 2312 // XMLHttpRequest over bad ssl in synchronous mode. |
| 2292 | 2313 |
| 2293 // XMLHttpRequest over OK ssl in synchronous mode. | 2314 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |