| 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" |
| 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/test/simple_test_clock.h" | 17 #include "base/test/simple_test_clock.h" |
| 18 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "chrome/app/chrome_command_ids.h" | 20 #include "chrome/app/chrome_command_ids.h" |
| 21 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
| 22 #include "chrome/browser/chrome_notification_types.h" | 22 #include "chrome/browser/chrome_notification_types.h" |
| 23 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 23 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" | 24 #include "chrome/browser/interstitials/security_interstitial_page_test_utils.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ssl/bad_clock_blocking_page.h" | 26 #include "chrome/browser/ssl/bad_clock_blocking_page.h" |
| 26 #include "chrome/browser/ssl/cert_report_helper.h" | 27 #include "chrome/browser/ssl/cert_report_helper.h" |
| 27 #include "chrome/browser/ssl/cert_verifier_browser_test.h" | 28 #include "chrome/browser/ssl/cert_verifier_browser_test.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/common_name_mismatch_handler.h" | 31 #include "chrome/browser/ssl/common_name_mismatch_handler.h" |
| 31 #include "chrome/browser/ssl/security_state_model.h" | 32 #include "chrome/browser/ssl/security_state_model.h" |
| 32 #include "chrome/browser/ssl/ssl_blocking_page.h" | 33 #include "chrome/browser/ssl/ssl_blocking_page.h" |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1088 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 1089 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 1089 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); | 1090 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); |
| 1090 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 1091 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
| 1091 | 1092 |
| 1092 // Add an entry into AutoSelectCertificateForUrls policy for automatic client | 1093 // Add an entry into AutoSelectCertificateForUrls policy for automatic client |
| 1093 // cert selection. | 1094 // cert selection. |
| 1094 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); | 1095 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); |
| 1095 DCHECK(profile); | 1096 DCHECK(profile); |
| 1096 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); | 1097 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); |
| 1097 dict->SetString("ISSUER.CN", "pywebsocket"); | 1098 dict->SetString("ISSUER.CN", "pywebsocket"); |
| 1098 profile->GetHostContentSettingsMap()->SetWebsiteSetting( | 1099 HostContentSettingsMapFactory::GetForProfile(profile)->SetWebsiteSetting( |
| 1099 ContentSettingsPattern::FromURL(url), | 1100 ContentSettingsPattern::FromURL(url), |
| 1100 ContentSettingsPattern::FromURL(url), | 1101 ContentSettingsPattern::FromURL(url), |
| 1101 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 1102 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
| 1102 std::string(), | 1103 std::string(), |
| 1103 dict.release()); | 1104 dict.release()); |
| 1104 | 1105 |
| 1105 // Visit a HTTPS page which requires client certs. | 1106 // Visit a HTTPS page which requires client certs. |
| 1106 ui_test_utils::NavigateToURL(browser(), url); | 1107 ui_test_utils::NavigateToURL(browser(), url); |
| 1107 CheckAuthenticatedState(tab, AuthState::NONE); | 1108 CheckAuthenticatedState(tab, AuthState::NONE); |
| 1108 | 1109 |
| (...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2222 // http://crbug.com/322948 | 2223 // http://crbug.com/322948 |
| 2223 #if defined(OS_LINUX) | 2224 #if defined(OS_LINUX) |
| 2224 // flaky http://crbug.com/396458 | 2225 // flaky http://crbug.com/396458 |
| 2225 #define MAYBE_TestInterstitialJavaScriptProceeds \ | 2226 #define MAYBE_TestInterstitialJavaScriptProceeds \ |
| 2226 DISABLED_TestInterstitialJavaScriptProceeds | 2227 DISABLED_TestInterstitialJavaScriptProceeds |
| 2227 #else | 2228 #else |
| 2228 #define MAYBE_TestInterstitialJavaScriptProceeds \ | 2229 #define MAYBE_TestInterstitialJavaScriptProceeds \ |
| 2229 TestInterstitialJavaScriptProceeds | 2230 TestInterstitialJavaScriptProceeds |
| 2230 #endif | 2231 #endif |
| 2231 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestInterstitialJavaScriptProceeds) { | 2232 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestInterstitialJavaScriptProceeds) { |
| 2232 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 2233 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
| 2233 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); | 2234 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
| 2235 CONTENT_SETTING_BLOCK); |
| 2234 | 2236 |
| 2235 ASSERT_TRUE(https_server_expired_.Start()); | 2237 ASSERT_TRUE(https_server_expired_.Start()); |
| 2236 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2238 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 2237 ui_test_utils::NavigateToURL(browser(), | 2239 ui_test_utils::NavigateToURL(browser(), |
| 2238 https_server_expired_.GetURL("files/ssl/google.html")); | 2240 https_server_expired_.GetURL("files/ssl/google.html")); |
| 2239 CheckAuthenticationBrokenState( | 2241 CheckAuthenticationBrokenState( |
| 2240 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); | 2242 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); |
| 2241 | 2243 |
| 2242 content::WindowedNotificationObserver observer( | 2244 content::WindowedNotificationObserver observer( |
| 2243 content::NOTIFICATION_LOAD_STOP, | 2245 content::NOTIFICATION_LOAD_STOP, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2256 // The above will hang without the fix. | 2258 // The above will hang without the fix. |
| 2257 EXPECT_EQ(1, result); | 2259 EXPECT_EQ(1, result); |
| 2258 observer.Wait(); | 2260 observer.Wait(); |
| 2259 CheckAuthenticationBrokenState( | 2261 CheckAuthenticationBrokenState( |
| 2260 tab, net::CERT_STATUS_DATE_INVALID, AuthState::NONE); | 2262 tab, net::CERT_STATUS_DATE_INVALID, AuthState::NONE); |
| 2261 } | 2263 } |
| 2262 | 2264 |
| 2263 // Verifies that the interstitial can go back, even if JavaScript is disabled. | 2265 // Verifies that the interstitial can go back, even if JavaScript is disabled. |
| 2264 // http://crbug.com/322948 | 2266 // http://crbug.com/322948 |
| 2265 IN_PROC_BROWSER_TEST_F(SSLUITest, TestInterstitialJavaScriptGoesBack) { | 2267 IN_PROC_BROWSER_TEST_F(SSLUITest, TestInterstitialJavaScriptGoesBack) { |
| 2266 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( | 2268 HostContentSettingsMapFactory::GetForProfile(browser()->profile()) |
| 2267 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); | 2269 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
| 2270 CONTENT_SETTING_BLOCK); |
| 2268 | 2271 |
| 2269 ASSERT_TRUE(https_server_expired_.Start()); | 2272 ASSERT_TRUE(https_server_expired_.Start()); |
| 2270 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); | 2273 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); |
| 2271 ui_test_utils::NavigateToURL(browser(), | 2274 ui_test_utils::NavigateToURL(browser(), |
| 2272 https_server_expired_.GetURL("files/ssl/google.html")); | 2275 https_server_expired_.GetURL("files/ssl/google.html")); |
| 2273 CheckAuthenticationBrokenState( | 2276 CheckAuthenticationBrokenState( |
| 2274 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); | 2277 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); |
| 2275 | 2278 |
| 2276 content::WindowedNotificationObserver observer( | 2279 content::WindowedNotificationObserver observer( |
| 2277 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, | 2280 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2734 | 2737 |
| 2735 // Visit a page over https that contains a frame with a redirect. | 2738 // Visit a page over https that contains a frame with a redirect. |
| 2736 | 2739 |
| 2737 // XMLHttpRequest insecure content in synchronous mode. | 2740 // XMLHttpRequest insecure content in synchronous mode. |
| 2738 | 2741 |
| 2739 // XMLHttpRequest insecure content in asynchronous mode. | 2742 // XMLHttpRequest insecure content in asynchronous mode. |
| 2740 | 2743 |
| 2741 // XMLHttpRequest over bad ssl in synchronous mode. | 2744 // XMLHttpRequest over bad ssl in synchronous mode. |
| 2742 | 2745 |
| 2743 // XMLHttpRequest over OK ssl in synchronous mode. | 2746 // XMLHttpRequest over OK ssl in synchronous mode. |
| OLD | NEW |