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

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

Issue 1312453005: Removed Profile::GetHostContentSettingsMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict Created 5 years, 3 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
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/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/connection_security.h" 32 #include "chrome/browser/ssl/connection_security.h"
32 #include "chrome/browser/ssl/ssl_blocking_page.h" 33 #include "chrome/browser/ssl/ssl_blocking_page.h"
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 1111 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
1111 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS")); 1112 content::TitleWatcher watcher(tab, ASCIIToUTF16("PASS"));
1112 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); 1113 watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL"));
1113 1114
1114 // Add an entry into AutoSelectCertificateForUrls policy for automatic client 1115 // Add an entry into AutoSelectCertificateForUrls policy for automatic client
1115 // cert selection. 1116 // cert selection.
1116 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext()); 1117 Profile* profile = Profile::FromBrowserContext(tab->GetBrowserContext());
1117 DCHECK(profile); 1118 DCHECK(profile);
1118 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); 1119 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
1119 dict->SetString("ISSUER.CN", "pywebsocket"); 1120 dict->SetString("ISSUER.CN", "pywebsocket");
1120 profile->GetHostContentSettingsMap()->SetWebsiteSetting( 1121 HostContentSettingsMapFactory::GetForProfile(profile)->SetWebsiteSetting(
1121 ContentSettingsPattern::FromURL(url), 1122 ContentSettingsPattern::FromURL(url),
1122 ContentSettingsPattern::FromURL(url), 1123 ContentSettingsPattern::FromURL(url),
1123 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, 1124 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE,
1124 std::string(), 1125 std::string(),
1125 dict.release()); 1126 dict.release());
1126 1127
1127 // Visit a HTTPS page which requires client certs. 1128 // Visit a HTTPS page which requires client certs.
1128 ui_test_utils::NavigateToURL(browser(), url); 1129 ui_test_utils::NavigateToURL(browser(), url);
1129 CheckAuthenticatedState(tab, AuthState::NONE); 1130 CheckAuthenticatedState(tab, AuthState::NONE);
1130 1131
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
2244 // http://crbug.com/322948 2245 // http://crbug.com/322948
2245 #if defined(OS_LINUX) 2246 #if defined(OS_LINUX)
2246 // flaky http://crbug.com/396458 2247 // flaky http://crbug.com/396458
2247 #define MAYBE_TestInterstitialJavaScriptProceeds \ 2248 #define MAYBE_TestInterstitialJavaScriptProceeds \
2248 DISABLED_TestInterstitialJavaScriptProceeds 2249 DISABLED_TestInterstitialJavaScriptProceeds
2249 #else 2250 #else
2250 #define MAYBE_TestInterstitialJavaScriptProceeds \ 2251 #define MAYBE_TestInterstitialJavaScriptProceeds \
2251 TestInterstitialJavaScriptProceeds 2252 TestInterstitialJavaScriptProceeds
2252 #endif 2253 #endif
2253 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestInterstitialJavaScriptProceeds) { 2254 IN_PROC_BROWSER_TEST_F(SSLUITest, MAYBE_TestInterstitialJavaScriptProceeds) {
2254 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( 2255 HostContentSettingsMapFactory::GetForProfile(browser()->profile())
2255 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); 2256 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT,
2257 CONTENT_SETTING_BLOCK);
2256 2258
2257 ASSERT_TRUE(https_server_expired_.Start()); 2259 ASSERT_TRUE(https_server_expired_.Start());
2258 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2260 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2259 ui_test_utils::NavigateToURL(browser(), 2261 ui_test_utils::NavigateToURL(browser(),
2260 https_server_expired_.GetURL("files/ssl/google.html")); 2262 https_server_expired_.GetURL("files/ssl/google.html"));
2261 CheckAuthenticationBrokenState( 2263 CheckAuthenticationBrokenState(
2262 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); 2264 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL);
2263 2265
2264 content::WindowedNotificationObserver observer( 2266 content::WindowedNotificationObserver observer(
2265 content::NOTIFICATION_LOAD_STOP, 2267 content::NOTIFICATION_LOAD_STOP,
(...skipping 12 matching lines...) Expand all
2278 // The above will hang without the fix. 2280 // The above will hang without the fix.
2279 EXPECT_EQ(1, result); 2281 EXPECT_EQ(1, result);
2280 observer.Wait(); 2282 observer.Wait();
2281 CheckAuthenticationBrokenState( 2283 CheckAuthenticationBrokenState(
2282 tab, net::CERT_STATUS_DATE_INVALID, AuthState::NONE); 2284 tab, net::CERT_STATUS_DATE_INVALID, AuthState::NONE);
2283 } 2285 }
2284 2286
2285 // Verifies that the interstitial can go back, even if JavaScript is disabled. 2287 // Verifies that the interstitial can go back, even if JavaScript is disabled.
2286 // http://crbug.com/322948 2288 // http://crbug.com/322948
2287 IN_PROC_BROWSER_TEST_F(SSLUITest, TestInterstitialJavaScriptGoesBack) { 2289 IN_PROC_BROWSER_TEST_F(SSLUITest, TestInterstitialJavaScriptGoesBack) {
2288 browser()->profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( 2290 HostContentSettingsMapFactory::GetForProfile(browser()->profile())
2289 CONTENT_SETTINGS_TYPE_JAVASCRIPT, CONTENT_SETTING_BLOCK); 2291 ->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT,
2292 CONTENT_SETTING_BLOCK);
2290 2293
2291 ASSERT_TRUE(https_server_expired_.Start()); 2294 ASSERT_TRUE(https_server_expired_.Start());
2292 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents(); 2295 WebContents* tab = browser()->tab_strip_model()->GetActiveWebContents();
2293 ui_test_utils::NavigateToURL(browser(), 2296 ui_test_utils::NavigateToURL(browser(),
2294 https_server_expired_.GetURL("files/ssl/google.html")); 2297 https_server_expired_.GetURL("files/ssl/google.html"));
2295 CheckAuthenticationBrokenState( 2298 CheckAuthenticationBrokenState(
2296 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL); 2299 tab, net::CERT_STATUS_DATE_INVALID, AuthState::SHOWING_INTERSTITIAL);
2297 2300
2298 content::WindowedNotificationObserver observer( 2301 content::WindowedNotificationObserver observer(
2299 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 2302 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2834 2837
2835 // Visit a page over https that contains a frame with a redirect. 2838 // Visit a page over https that contains a frame with a redirect.
2836 2839
2837 // XMLHttpRequest insecure content in synchronous mode. 2840 // XMLHttpRequest insecure content in synchronous mode.
2838 2841
2839 // XMLHttpRequest insecure content in asynchronous mode. 2842 // XMLHttpRequest insecure content in asynchronous mode.
2840 2843
2841 // XMLHttpRequest over bad ssl in synchronous mode. 2844 // XMLHttpRequest over bad ssl in synchronous mode.
2842 2845
2843 // XMLHttpRequest over OK ssl in synchronous mode. 2846 // XMLHttpRequest over OK ssl in synchronous mode.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698