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

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

Issue 1058003004: Forget SSL error exceptions when good certs seen for regular requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Yet Another Webview Fix (should be the last, I swear) Created 5 years, 8 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/chrome_ssl_host_state_delegate.h ('k') | content/browser/ssl/ssl_policy.cc » ('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/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
16 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
17 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" 18 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h"
19 #include "chrome/browser/net/certificate_error_reporter.h" 19 #include "chrome/browser/net/certificate_error_reporter.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/safe_browsing/ping_manager.h" 21 #include "chrome/browser/safe_browsing/ping_manager.h"
22 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 22 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
23 #include "chrome/browser/safe_browsing/ui_manager.h" 23 #include "chrome/browser/safe_browsing/ui_manager.h"
24 #include "chrome/browser/ssl/chrome_ssl_host_state_delegate.h"
24 #include "chrome/browser/ssl/ssl_blocking_page.h" 25 #include "chrome/browser/ssl/ssl_blocking_page.h"
25 #include "chrome/browser/ui/browser.h" 26 #include "chrome/browser/ui/browser.h"
26 #include "chrome/browser/ui/browser_commands.h" 27 #include "chrome/browser/ui/browser_commands.h"
27 #include "chrome/browser/ui/browser_navigator.h" 28 #include "chrome/browser/ui/browser_navigator.h"
28 #include "chrome/browser/ui/browser_tabstrip.h" 29 #include "chrome/browser/ui/browser_tabstrip.h"
29 #include "chrome/browser/ui/tabs/tab_strip_model.h" 30 #include "chrome/browser/ui/tabs/tab_strip_model.h"
30 #include "chrome/common/chrome_paths.h" 31 #include "chrome/common/chrome_paths.h"
31 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/pref_names.h" 33 #include "chrome/common/pref_names.h"
33 #include "chrome/test/base/in_process_browser_test.h" 34 #include "chrome/test/base/in_process_browser_test.h"
34 #include "chrome/test/base/ui_test_utils.h" 35 #include "chrome/test/base/ui_test_utils.h"
35 #include "components/content_settings/core/browser/host_content_settings_map.h" 36 #include "components/content_settings/core/browser/host_content_settings_map.h"
36 #include "components/variations/variations_associated_data.h" 37 #include "components/variations/variations_associated_data.h"
37 #include "components/web_modal/web_contents_modal_dialog_manager.h" 38 #include "components/web_modal/web_contents_modal_dialog_manager.h"
38 #include "content/public/browser/browser_context.h" 39 #include "content/public/browser/browser_context.h"
39 #include "content/public/browser/interstitial_page.h" 40 #include "content/public/browser/interstitial_page.h"
40 #include "content/public/browser/navigation_controller.h" 41 #include "content/public/browser/navigation_controller.h"
41 #include "content/public/browser/navigation_entry.h" 42 #include "content/public/browser/navigation_entry.h"
42 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/render_frame_host.h" 44 #include "content/public/browser/render_frame_host.h"
45 #include "content/public/browser/render_process_host.h"
44 #include "content/public/browser/render_view_host.h" 46 #include "content/public/browser/render_view_host.h"
45 #include "content/public/browser/render_widget_host_view.h" 47 #include "content/public/browser/render_widget_host_view.h"
46 #include "content/public/browser/web_contents.h" 48 #include "content/public/browser/web_contents.h"
47 #include "content/public/browser/web_contents_observer.h" 49 #include "content/public/browser/web_contents_observer.h"
48 #include "content/public/common/security_style.h" 50 #include "content/public/common/security_style.h"
49 #include "content/public/common/ssl_status.h" 51 #include "content/public/common/ssl_status.h"
50 #include "content/public/test/browser_test_utils.h" 52 #include "content/public/test/browser_test_utils.h"
51 #include "content/public/test/download_test_observer.h" 53 #include "content/public/test/download_test_observer.h"
52 #include "content/public/test/test_renderer_host.h" 54 #include "content/public/test/test_renderer_host.h"
55 #include "net/base/host_port_pair.h"
53 #include "net/base/net_errors.h" 56 #include "net/base/net_errors.h"
54 #include "net/base/test_data_directory.h" 57 #include "net/base/test_data_directory.h"
55 #include "net/cert/cert_status_flags.h" 58 #include "net/cert/cert_status_flags.h"
59 #include "net/cert/test_root_certs.h"
56 #include "net/cert/x509_certificate.h" 60 #include "net/cert/x509_certificate.h"
61 #include "net/dns/host_resolver.h"
62 #include "net/dns/mock_host_resolver.h"
63 #include "net/http/http_transaction_factory.h"
57 #include "net/ssl/ssl_info.h" 64 #include "net/ssl/ssl_info.h"
58 #include "net/test/spawned_test_server/spawned_test_server.h" 65 #include "net/test/spawned_test_server/spawned_test_server.h"
59 #include "net/url_request/url_request_context.h" 66 #include "net/url_request/url_request_context.h"
67 #include "net/url_request/url_request_context_getter.h"
60 68
61 #if defined(USE_NSS_CERTS) 69 #if defined(USE_NSS_CERTS)
62 #include "chrome/browser/net/nss_context.h" 70 #include "chrome/browser/net/nss_context.h"
63 #include "net/base/crypto_module.h" 71 #include "net/base/crypto_module.h"
64 #include "net/cert/nss_cert_database.h" 72 #include "net/cert/nss_cert_database.h"
65 #endif // defined(USE_NSS_CERTS) 73 #endif // defined(USE_NSS_CERTS)
66 74
67 using base::ASCIIToUTF16; 75 using base::ASCIIToUTF16;
68 using chrome_browser_interstitials::SecurityInterstitialIDNTest; 76 using chrome_browser_interstitials::SecurityInterstitialIDNTest;
69 using chrome_browser_net::CertificateErrorReporter; 77 using chrome_browser_net::CertificateErrorReporter;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 266
259 private: 267 private:
260 const scoped_refptr<SafeBrowsingUIManager> safe_browsing_ui_manager_; 268 const scoped_refptr<SafeBrowsingUIManager> safe_browsing_ui_manager_;
261 bool reported_; 269 bool reported_;
262 bool expect_report_; 270 bool expect_report_;
263 base::Closure report_sent_callback_; 271 base::Closure report_sent_callback_;
264 }; 272 };
265 273
266 } // namespace CertificateReporting 274 } // namespace CertificateReporting
267 275
276 void RootCertsChangedOnIOThread(
277 const scoped_refptr<net::URLRequestContextGetter> context_getter) {
278 net::CertDatabase::GetInstance()->NotifyObserversOfCACertChanged(NULL);
279 context_getter->GetURLRequestContext()
280 ->http_transaction_factory()
281 ->GetSession()
282 ->CloseAllConnections();
283 }
284
285 // Alerts the URLRequestContext for the given WebContents that a root
286 // certificate has changed state or been removed. This, in turn, clears any
287 // cached certificate validation in the cert verifier. This will also close all
288 // connections in the socket pool of |contents|, so calls to this should be made
289 // with care.
290 void RootCertsChanged(WebContents* contents) {
291 scoped_refptr<net::URLRequestContextGetter> url_request_context =
292 contents->GetBrowserContext()->GetRequestContextForRenderProcess(
293 contents->GetRenderProcessHost()->GetID());
294 base::RunLoop run_loop;
295 content::BrowserThread::PostTaskAndReply(
296 content::BrowserThread::IO, FROM_HERE,
297 base::Bind(&RootCertsChangedOnIOThread, url_request_context),
298 run_loop.QuitClosure());
299 run_loop.Run();
300 base::RunLoop().RunUntilIdle();
301 }
302
268 } // namespace 303 } // namespace
269 304
270 class SSLUITest : public InProcessBrowserTest { 305 class SSLUITest : public InProcessBrowserTest {
271 public: 306 public:
272 SSLUITest() 307 SSLUITest()
273 : https_server_(net::SpawnedTestServer::TYPE_HTTPS, 308 : https_server_(net::SpawnedTestServer::TYPE_HTTPS,
274 SSLOptions(SSLOptions::CERT_OK), 309 SSLOptions(SSLOptions::CERT_OK),
275 base::FilePath(kDocRoot)), 310 base::FilePath(kDocRoot)),
276 https_server_expired_(net::SpawnedTestServer::TYPE_HTTPS, 311 https_server_expired_(net::SpawnedTestServer::TYPE_HTTPS,
277 SSLOptions(SSLOptions::CERT_EXPIRED), 312 SSLOptions(SSLOptions::CERT_EXPIRED),
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 std::vector<net::SpawnedTestServer::StringPair> replacement_text_top_frame; 466 std::vector<net::SpawnedTestServer::StringPair> replacement_text_top_frame;
432 replacement_text_top_frame.push_back( 467 replacement_text_top_frame.push_back(
433 make_pair("REPLACE_WITH_FRAME_LEFT_PATH", frame_left_path)); 468 make_pair("REPLACE_WITH_FRAME_LEFT_PATH", frame_left_path));
434 return net::SpawnedTestServer::GetFilePathWithReplacements( 469 return net::SpawnedTestServer::GetFilePathWithReplacements(
435 "files/ssl/top_frame.html", 470 "files/ssl/top_frame.html",
436 replacement_text_top_frame, 471 replacement_text_top_frame,
437 top_frame_path); 472 top_frame_path);
438 } 473 }
439 474
440 static bool GetPageWithUnsafeWorkerPath( 475 static bool GetPageWithUnsafeWorkerPath(
441 const net::SpawnedTestServer& expired_https_server, 476 const net::SpawnedTestServer& https_server,
442 std::string* page_with_unsafe_worker_path) { 477 std::string* page_with_unsafe_worker_path) {
443 // Get the "imported.js" URL from the expired https server and 478 // Get the "imported.js" URL from the expired https server and
444 // substitute it into the unsafe_worker.js file. 479 // substitute it into the unsafe_worker.js file.
445 GURL imported_js_url = expired_https_server.GetURL("files/ssl/imported.js"); 480 GURL imported_js_url = https_server.GetURL("files/ssl/imported.js");
446 std::vector<net::SpawnedTestServer::StringPair> 481 std::vector<net::SpawnedTestServer::StringPair>
447 replacement_text_for_unsafe_worker; 482 replacement_text_for_unsafe_worker;
448 replacement_text_for_unsafe_worker.push_back( 483 replacement_text_for_unsafe_worker.push_back(
449 make_pair("REPLACE_WITH_IMPORTED_JS_URL", imported_js_url.spec())); 484 make_pair("REPLACE_WITH_IMPORTED_JS_URL", imported_js_url.spec()));
450 std::string unsafe_worker_path; 485 std::string unsafe_worker_path;
451 if (!net::SpawnedTestServer::GetFilePathWithReplacements( 486 if (!net::SpawnedTestServer::GetFilePathWithReplacements(
452 "unsafe_worker.js", 487 "unsafe_worker.js",
453 replacement_text_for_unsafe_worker, 488 replacement_text_for_unsafe_worker,
454 &unsafe_worker_path)) 489 &unsafe_worker_path))
455 return false; 490 return false;
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 &page_with_unsafe_worker_path)); 2060 &page_with_unsafe_worker_path));
2026 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( 2061 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL(
2027 page_with_unsafe_worker_path)); 2062 page_with_unsafe_worker_path));
2028 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2063 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2029 // Expect Worker not to load insecure content. 2064 // Expect Worker not to load insecure content.
2030 CheckWorkerLoadResult(tab, false); 2065 CheckWorkerLoadResult(tab, false);
2031 // The bad content is filtered, expect the state to be authenticated. 2066 // The bad content is filtered, expect the state to be authenticated.
2032 CheckAuthenticatedState(tab, AuthState::NONE); 2067 CheckAuthenticatedState(tab, AuthState::NONE);
2033 } 2068 }
2034 2069
2035 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorker) { 2070 // This test, and the related test TestUnsafeContentsWithUserException, verify
2071 // that if unsafe content is loaded but the host of that unsafe content has a
2072 // user exception, the content runs and the security style remains
2073 // authenticated. This is not necessarily the behavior that should exist, but it
2074 // is verification that it does behave that way. See https://crbug.com/477868
2075 // for more inforamtion on this.
2076 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsInWorkerWithUserException) {
2036 ASSERT_TRUE(https_server_.Start()); 2077 ASSERT_TRUE(https_server_.Start());
2037 ASSERT_TRUE(https_server_expired_.Start()); 2078 // Note that it is necessary to user https_server_mismatched_ here over the
2079 // other invalid cert servers. This is because the test relies on the two
2080 // servers having different hosts since SSL exceptions are per-host, not per
2081 // origin, and https_server_mismatched_ uses 'localhost' rather than
2082 // '127.0.0.1'.
2083 ASSERT_TRUE(https_server_mismatched_.Start());
2038 2084
2039 // Navigate to an unsafe site. Proceed with interstitial page to indicate 2085 // Navigate to an unsafe site. Proceed with interstitial page to indicate
2040 // the user approves the bad certificate. 2086 // the user approves the bad certificate.
2041 ui_test_utils::NavigateToURL(browser(), 2087 ui_test_utils::NavigateToURL(
2042 https_server_expired_.GetURL("files/ssl/blank_page.html")); 2088 browser(), https_server_mismatched_.GetURL("files/ssl/blank_page.html"));
2043 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2089 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2044 CheckAuthenticationBrokenState( 2090 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
2045 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); 2091 AuthState::SHOWING_INTERSTITIAL);
2046 ProceedThroughInterstitial(tab); 2092 ProceedThroughInterstitial(tab);
2047 CheckAuthenticationBrokenState( 2093 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
2048 tab, net::CERT_STATUS_DATE_INVALID, AuthState::NONE); 2094 AuthState::NONE);
2049 2095
2050 // Navigate to safe page that has Worker loading unsafe content. 2096 // Navigate to safe page that has Worker loading unsafe content.
2051 // Expect content to load but be marked as auth broken due to running insecure 2097 // Expect content to load but be marked as auth broken due to running insecure
2052 // content. 2098 // content.
2053 std::string page_with_unsafe_worker_path; 2099 std::string page_with_unsafe_worker_path;
2054 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_expired_, 2100 ASSERT_TRUE(GetPageWithUnsafeWorkerPath(https_server_mismatched_,
2055 &page_with_unsafe_worker_path)); 2101 &page_with_unsafe_worker_path));
2056 ui_test_utils::NavigateToURL(browser(), https_server_.GetURL( 2102 ui_test_utils::NavigateToURL(
2057 page_with_unsafe_worker_path)); 2103 browser(), https_server_.GetURL(page_with_unsafe_worker_path));
2058 CheckWorkerLoadResult(tab, true); // Worker loads insecure content 2104 CheckWorkerLoadResult(tab, true); // Worker loads insecure content
2059 CheckAuthenticationBrokenState( 2105 CheckAuthenticatedState(tab, CertError::NONE);
2060 tab, CertError::NONE, AuthState::RAN_INSECURE_CONTENT); 2106 }
2107
2108 // Visits a page with unsafe content and makes sure that if a user exception to
2109 // the certificate error is present, the image is loaded and script executes.
2110 //
2111 // See the comment above SSLUITest.TestUnsafeContentsInWorkerWithUserException
2112 // for a discussion about the desired behavior.
2113 IN_PROC_BROWSER_TEST_F(SSLUITest, TestUnsafeContentsWithUserException) {
2114 ASSERT_TRUE(https_server_.Start());
2115 // Note that it is necessary to user https_server_mismatched_ here over the
2116 // other invalid cert servers. This is because the test relies on the two
2117 // servers having different hosts since SSL exceptions are per-host, not per
2118 // origin, and https_server_mismatched_ uses 'localhost' rather than
2119 // '127.0.0.1'.
2120 ASSERT_TRUE(https_server_mismatched_.Start());
2121
2122 // Navigate to an unsafe site. Proceed with interstitial page to indicate
2123 // the user approves the bad certificate.
2124 ui_test_utils::NavigateToURL(
2125 browser(), https_server_mismatched_.GetURL("files/ssl/blank_page.html"));
2126 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2127 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
2128 AuthState::SHOWING_INTERSTITIAL);
2129 ProceedThroughInterstitial(tab);
2130 CheckAuthenticationBrokenState(tab, net::CERT_STATUS_COMMON_NAME_INVALID,
2131 AuthState::NONE);
2132
2133 std::string replacement_path;
2134 ASSERT_TRUE(GetFilePathWithHostAndPortReplacement(
2135 "files/ssl/page_with_unsafe_contents.html",
2136 https_server_mismatched_.host_port_pair(), &replacement_path));
2137 ui_test_utils::NavigateToURL(browser(),
2138 https_server_.GetURL(replacement_path));
2139
2140 // When the bad content is filtered, the state is expected to be
2141 // authenticated.
2142 CheckAuthenticatedState(tab, AuthState::NONE);
2143
2144 int img_width;
2145 EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
2146 tab, "window.domAutomationController.send(ImageWidth());", &img_width));
2147 // In order to check that the image was loaded, we check its width.
2148 // The actual image (Google logo) is 114 pixels wide, so we assume a good
2149 // image is greater than 100.
2150 EXPECT_GT(img_width, 100);
2151
2152 bool js_result = false;
2153 EXPECT_TRUE(content::ExecuteScriptAndExtractBool(
2154 tab, "window.domAutomationController.send(IsFooSet());", &js_result));
2155 EXPECT_TRUE(js_result);
2156 CheckAuthenticatedState(tab, CertError::NONE);
2061 } 2157 }
2062 2158
2063 // Test that when the browser blocks displaying insecure content (images), the 2159 // Test that when the browser blocks displaying insecure content (images), the
2064 // indicator shows a secure page, because the blocking made the otherwise 2160 // indicator shows a secure page, because the blocking made the otherwise
2065 // unsafe page safe (the notification of this state is handled by other means). 2161 // unsafe page safe (the notification of this state is handled by other means).
2066 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureImage) { 2162 IN_PROC_BROWSER_TEST_F(SSLUITestBlock, TestBlockDisplayingInsecureImage) {
2067 ASSERT_TRUE(test_server()->Start()); 2163 ASSERT_TRUE(test_server()->Start());
2068 ASSERT_TRUE(https_server_.Start()); 2164 ASSERT_TRUE(https_server_.Start());
2069 2165
2070 std::string replacement_path; 2166 std::string replacement_path;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
2241 ui::PAGE_TRANSITION_TYPED); 2337 ui::PAGE_TRANSITION_TYPED);
2242 EXPECT_EQ(2, browser()->tab_strip_model()->count()); 2338 EXPECT_EQ(2, browser()->tab_strip_model()->count());
2243 EXPECT_EQ(0, browser()->tab_strip_model()->active_index()); 2339 EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
2244 EXPECT_EQ(tab, browser()->tab_strip_model()->GetWebContentsAt(1)); 2340 EXPECT_EQ(tab, browser()->tab_strip_model()->GetWebContentsAt(1));
2245 EXPECT_FALSE(tab->GetRenderWidgetHostView()->IsShowing()); 2341 EXPECT_FALSE(tab->GetRenderWidgetHostView()->IsShowing());
2246 2342
2247 browser()->tab_strip_model()->ActivateTabAt(1, true); 2343 browser()->tab_strip_model()->ActivateTabAt(1, true);
2248 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing()); 2344 EXPECT_TRUE(tab->GetRenderWidgetHostView()->IsShowing());
2249 } 2345 }
2250 2346
2347 // Verifies that if a bad certificate is seen for a host and the user proceeds
2348 // through the interstitial, the decision to proceed is initially remembered.
2349 // However, if this is followed by another visit, and a good certificate
2350 // is seen for the same host, the original exception is forgotten.
2351 IN_PROC_BROWSER_TEST_F(SSLUITest, BadCertFollowedByGoodCert) {
2352 ASSERT_TRUE(https_server_.Start());
2353 std::string https_server_host =
2354 https_server_.GetURL("files/ssl/google.html").host();
2355
2356 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2357 net::TestRootCerts* root_certs = net::TestRootCerts::GetInstance();
2358
2359 ASSERT_TRUE(root_certs);
2360 root_certs->Clear();
2361
2362 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext());
2363 ChromeSSLHostStateDelegate* state =
2364 reinterpret_cast<ChromeSSLHostStateDelegate*>(
2365 profile->GetSSLHostStateDelegate());
2366
2367 ui_test_utils::NavigateToURL(browser(),
2368 https_server_.GetURL("files/ssl/google.html"));
2369
2370 ProceedThroughInterstitial(tab);
2371 EXPECT_TRUE(state->HasAllowException(https_server_host));
2372
2373 ASSERT_TRUE(https_server_.LoadTestRootCert());
2374 RootCertsChanged(tab);
2375 ui_test_utils::NavigateToURL(browser(),
2376 https_server_.GetURL("files/ssl/google.html"));
2377 ASSERT_FALSE(tab->GetInterstitialPage());
2378 EXPECT_FALSE(state->HasAllowException(https_server_host));
2379 }
2380
2251 class SSLBlockingPageIDNTest : public SecurityInterstitialIDNTest { 2381 class SSLBlockingPageIDNTest : public SecurityInterstitialIDNTest {
2252 protected: 2382 protected:
2253 // SecurityInterstitialIDNTest implementation 2383 // SecurityInterstitialIDNTest implementation
2254 SecurityInterstitialPage* CreateInterstitial( 2384 SecurityInterstitialPage* CreateInterstitial(
2255 content::WebContents* contents, 2385 content::WebContents* contents,
2256 const GURL& request_url) const override { 2386 const GURL& request_url) const override {
2257 net::SSLInfo ssl_info; 2387 net::SSLInfo ssl_info;
2258 ssl_info.cert = new net::X509Certificate( 2388 ssl_info.cert = new net::X509Certificate(
2259 request_url.host(), "CA", base::Time::Max(), base::Time::Max()); 2389 request_url.host(), "CA", base::Time::Max(), base::Time::Max());
2260 return new SSLBlockingPage( 2390 return new SSLBlockingPage(
(...skipping 10 matching lines...) Expand all
2271 2401
2272 // Visit a page over https that contains a frame with a redirect. 2402 // Visit a page over https that contains a frame with a redirect.
2273 2403
2274 // XMLHttpRequest insecure content in synchronous mode. 2404 // XMLHttpRequest insecure content in synchronous mode.
2275 2405
2276 // XMLHttpRequest insecure content in asynchronous mode. 2406 // XMLHttpRequest insecure content in asynchronous mode.
2277 2407
2278 // XMLHttpRequest over bad ssl in synchronous mode. 2408 // XMLHttpRequest over bad ssl in synchronous mode.
2279 2409
2280 // XMLHttpRequest over OK ssl in synchronous mode. 2410 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW
« no previous file with comments | « chrome/browser/ssl/chrome_ssl_host_state_delegate.h ('k') | content/browser/ssl/ssl_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698