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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 1164063004: Call GetSSLConfig on the IO thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enable the test Created 5 years, 6 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/net/ssl_config_service_manager_pref.cc ('k') | no next file » | 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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 2615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2626 blacklist.Append(new base::StringValue(folder_path)); 2626 blacklist.Append(new base::StringValue(folder_path));
2627 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY, 2627 policies.Set(key::kURLBlacklist, POLICY_LEVEL_MANDATORY,
2628 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL); 2628 POLICY_SCOPE_USER, blacklist.DeepCopy(), NULL);
2629 UpdateProviderPolicy(policies); 2629 UpdateProviderPolicy(policies);
2630 FlushBlacklistPolicy(); 2630 FlushBlacklistPolicy();
2631 2631
2632 CheckCanOpenURL(browser(), file_path1.c_str()); 2632 CheckCanOpenURL(browser(), file_path1.c_str());
2633 CheckURLIsBlocked(browser(), file_path2.c_str()); 2633 CheckURLIsBlocked(browser(), file_path2.c_str());
2634 } 2634 }
2635 2635
2636 static bool IsMinSSLFallbackVersionTLS12(Profile* profile) { 2636 namespace {
2637
2638 void GetSSLVersionFallbackMinOnIOThread(
2639 const scoped_refptr<net::SSLConfigService>& config_service,
2640 uint16_t* version_fallback_min) {
2641 net::SSLConfig config;
2642 config_service->GetSSLConfig(&config);
2643 *version_fallback_min = config.version_fallback_min;
2644 }
2645
2646 uint16_t GetSSLVersionFallbackMin(Profile* profile) {
2637 scoped_refptr<net::SSLConfigService> config_service( 2647 scoped_refptr<net::SSLConfigService> config_service(
2638 profile->GetSSLConfigService()); 2648 profile->GetSSLConfigService());
2639 net::SSLConfig config; 2649 uint16_t version_fallback_min;
2640 config_service->GetSSLConfig(&config); 2650 base::RunLoop loop;
2641 return config.version_fallback_min == net::SSL_PROTOCOL_VERSION_TLS1_2; 2651 BrowserThread::PostTaskAndReply(
2652 BrowserThread::IO, FROM_HERE,
2653 base::Bind(&GetSSLVersionFallbackMinOnIOThread, config_service,
2654 base::Unretained(&version_fallback_min)),
2655 loop.QuitClosure());
2656 loop.Run();
2657 return version_fallback_min;
2642 } 2658 }
2643 2659
2644 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_SSLVersionFallbackMin) { 2660 } // namespace
2661
2662 IN_PROC_BROWSER_TEST_F(PolicyTest, SSLVersionFallbackMin) {
2645 PrefService* prefs = g_browser_process->local_state(); 2663 PrefService* prefs = g_browser_process->local_state();
2646 2664
2647 const std::string new_value("tls1.2"); 2665 const std::string new_value("tls1.2");
2648 const std::string default_value( 2666 const std::string default_value(
2649 prefs->GetString(prefs::kSSLVersionFallbackMin)); 2667 prefs->GetString(prefs::kSSLVersionFallbackMin));
2650 2668
2651 EXPECT_NE(default_value, new_value); 2669 EXPECT_NE(default_value, new_value);
2652 EXPECT_FALSE(IsMinSSLFallbackVersionTLS12(browser()->profile())); 2670 EXPECT_NE(net::SSL_PROTOCOL_VERSION_TLS1_2,
2671 GetSSLVersionFallbackMin(browser()->profile()));
2653 2672
2654 PolicyMap policies; 2673 PolicyMap policies;
2655 policies.Set(key::kSSLVersionFallbackMin, 2674 policies.Set(key::kSSLVersionFallbackMin,
2656 POLICY_LEVEL_MANDATORY, 2675 POLICY_LEVEL_MANDATORY,
2657 POLICY_SCOPE_USER, 2676 POLICY_SCOPE_USER,
2658 new base::StringValue(new_value), 2677 new base::StringValue(new_value),
2659 NULL); 2678 NULL);
2660 UpdateProviderPolicy(policies); 2679 UpdateProviderPolicy(policies);
2661 2680
2662 EXPECT_TRUE(IsMinSSLFallbackVersionTLS12(browser()->profile())); 2681 EXPECT_EQ(net::SSL_PROTOCOL_VERSION_TLS1_2,
2682 GetSSLVersionFallbackMin(browser()->profile()));
2663 } 2683 }
2664 2684
2665 #if !defined(OS_MACOSX) 2685 #if !defined(OS_MACOSX)
2666 IN_PROC_BROWSER_TEST_F(PolicyTest, FullscreenAllowedBrowser) { 2686 IN_PROC_BROWSER_TEST_F(PolicyTest, FullscreenAllowedBrowser) {
2667 PolicyMap policies; 2687 PolicyMap policies;
2668 policies.Set(key::kFullscreenAllowed, 2688 policies.Set(key::kFullscreenAllowed,
2669 POLICY_LEVEL_MANDATORY, 2689 POLICY_LEVEL_MANDATORY,
2670 POLICY_SCOPE_USER, 2690 POLICY_SCOPE_USER,
2671 new base::FundamentalValue(false), 2691 new base::FundamentalValue(false),
2672 NULL); 2692 NULL);
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after
3810 PrefService* prefs = browser()->profile()->GetPrefs(); 3830 PrefService* prefs = browser()->profile()->GetPrefs();
3811 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed( 3831 EXPECT_TRUE(extensions::MessageService::IsNativeMessagingHostAllowed(
3812 prefs, "host.name")); 3832 prefs, "host.name"));
3813 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed( 3833 EXPECT_FALSE(extensions::MessageService::IsNativeMessagingHostAllowed(
3814 prefs, "other.host.name")); 3834 prefs, "other.host.name"));
3815 } 3835 }
3816 3836
3817 #endif // !defined(CHROME_OS) 3837 #endif // !defined(CHROME_OS)
3818 3838
3819 } // namespace policy 3839 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/net/ssl_config_service_manager_pref.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698