Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: chrome/browser/ssl/ssl_browser_tests.cc

Issue 1227943002: Allow browser tests to use a MockCertVerifier (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: put the files in the right .gypi Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ssl/cert_verifier_browser_test.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/stringprintf.h" 14 #include "base/strings/stringprintf.h"
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "base/test/histogram_tester.h" 16 #include "base/test/histogram_tester.h"
17 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "chrome/app/chrome_command_ids.h" 19 #include "chrome/app/chrome_command_ids.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/chrome_notification_types.h" 21 #include "chrome/browser/chrome_notification_types.h"
22 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" 22 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
23 #include "chrome/browser/net/certificate_error_reporter.h" 23 #include "chrome/browser/net/certificate_error_reporter.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/ssl/cert_logger.pb.h" 25 #include "chrome/browser/ssl/cert_logger.pb.h"
26 #include "chrome/browser/ssl/cert_report_helper.h" 26 #include "chrome/browser/ssl/cert_report_helper.h"
27 #include "chrome/browser/ssl/cert_verifier_browser_test.h"
27 #include "chrome/browser/ssl/certificate_error_report.h" 28 #include "chrome/browser/ssl/certificate_error_report.h"
28 #include "chrome/browser/ssl/certificate_reporting_test_utils.h" 29 #include "chrome/browser/ssl/certificate_reporting_test_utils.h"
29 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h" 30 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
30 #include "chrome/browser/ssl/ssl_blocking_page.h" 31 #include "chrome/browser/ssl/ssl_blocking_page.h"
31 #include "chrome/browser/ui/browser.h" 32 #include "chrome/browser/ui/browser.h"
32 #include "chrome/browser/ui/browser_commands.h" 33 #include "chrome/browser/ui/browser_commands.h"
33 #include "chrome/browser/ui/browser_navigator.h" 34 #include "chrome/browser/ui/browser_navigator.h"
34 #include "chrome/browser/ui/browser_tabstrip.h" 35 #include "chrome/browser/ui/browser_tabstrip.h"
35 #include "chrome/browser/ui/tabs/tab_strip_model.h" 36 #include "chrome/browser/ui/tabs/tab_strip_model.h"
36 #include "chrome/common/chrome_paths.h" 37 #include "chrome/common/chrome_paths.h"
(...skipping 17 matching lines...) Expand all
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
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(
2294 net::ERR_CERT_NAME_CONSTRAINT_VIOLATION);
2295
2296 ui_test_utils::NavigateToURL(browser(),
2297 https_server.GetURL("files/ssl/google.html"));
2298
2299 CheckSecurityState(browser()->tab_strip_model()->GetActiveWebContents(),
2300 net::CERT_STATUS_NAME_CONSTRAINT_VIOLATION,
2301 content::SECURITY_STYLE_AUTHENTICATION_BROKEN,
2302 AuthState::SHOWING_INTERSTITIAL);
2303 }
2304
2283 // TODO(jcampan): more tests to do below. 2305 // TODO(jcampan): more tests to do below.
2284 2306
2285 // Visit a page over https that contains a frame with a redirect. 2307 // Visit a page over https that contains a frame with a redirect.
2286 2308
2287 // XMLHttpRequest insecure content in synchronous mode. 2309 // XMLHttpRequest insecure content in synchronous mode.
2288 2310
2289 // XMLHttpRequest insecure content in asynchronous mode. 2311 // XMLHttpRequest insecure content in asynchronous mode.
2290 2312
2291 // XMLHttpRequest over bad ssl in synchronous mode. 2313 // XMLHttpRequest over bad ssl in synchronous mode.
2292 2314
2293 // XMLHttpRequest over OK ssl in synchronous mode. 2315 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« no previous file with comments | « chrome/browser/ssl/cert_verifier_browser_test.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698