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

Side by Side Diff: chrome/browser/net/ssl_config_service_manager_pref_unittest.cc

Issue 104493005: Update some uses of Value in chrome/browser to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 12 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 | Annotate | Revision Log
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 "chrome/browser/net/ssl_config_service_manager.h" 5 #include "chrome/browser/net/ssl_config_service_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/prefs/pref_registry_simple.h" 10 #include "base/prefs/pref_registry_simple.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 base::MessageLoop message_loop_; 46 base::MessageLoop message_loop_;
47 content::TestBrowserThread ui_thread_; 47 content::TestBrowserThread ui_thread_;
48 content::TestBrowserThread io_thread_; 48 content::TestBrowserThread io_thread_;
49 }; 49 };
50 50
51 // Test channel id with no user prefs. 51 // Test channel id with no user prefs.
52 TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithoutUserPrefs) { 52 TEST_F(SSLConfigServiceManagerPrefTest, ChannelIDWithoutUserPrefs) {
53 TestingPrefServiceSimple local_state; 53 TestingPrefServiceSimple local_state;
54 SSLConfigServiceManager::RegisterPrefs(local_state.registry()); 54 SSLConfigServiceManager::RegisterPrefs(local_state.registry());
55 local_state.SetUserPref(prefs::kEnableOriginBoundCerts, 55 local_state.SetUserPref(prefs::kEnableOriginBoundCerts,
56 Value::CreateBooleanValue(false)); 56 base::Value::CreateBooleanValue(false));
57 57
58 scoped_ptr<SSLConfigServiceManager> config_manager( 58 scoped_ptr<SSLConfigServiceManager> config_manager(
59 SSLConfigServiceManager::CreateDefaultManager(&local_state)); 59 SSLConfigServiceManager::CreateDefaultManager(&local_state));
60 ASSERT_TRUE(config_manager.get()); 60 ASSERT_TRUE(config_manager.get());
61 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); 61 scoped_refptr<SSLConfigService> config_service(config_manager->Get());
62 ASSERT_TRUE(config_service.get()); 62 ASSERT_TRUE(config_service.get());
63 63
64 SSLConfig config; 64 SSLConfig config;
65 config_service->GetSSLConfig(&config); 65 config_service->GetSSLConfig(&config);
66 EXPECT_FALSE(config.channel_id_enabled); 66 EXPECT_FALSE(config.channel_id_enabled);
67 67
68 local_state.SetUserPref(prefs::kEnableOriginBoundCerts, 68 local_state.SetUserPref(prefs::kEnableOriginBoundCerts,
69 Value::CreateBooleanValue(true)); 69 base::Value::CreateBooleanValue(true));
70 // Pump the message loop to notify the SSLConfigServiceManagerPref that the 70 // Pump the message loop to notify the SSLConfigServiceManagerPref that the
71 // preferences changed. 71 // preferences changed.
72 message_loop_.RunUntilIdle(); 72 message_loop_.RunUntilIdle();
73 config_service->GetSSLConfig(&config); 73 config_service->GetSSLConfig(&config);
74 EXPECT_TRUE(config.channel_id_enabled); 74 EXPECT_TRUE(config.channel_id_enabled);
75 } 75 }
76 76
77 // Test that cipher suites can be disabled. "Good" refers to the fact that 77 // Test that cipher suites can be disabled. "Good" refers to the fact that
78 // every value is expected to be successfully parsed into a cipher suite. 78 // every value is expected to be successfully parsed into a cipher suite.
79 TEST_F(SSLConfigServiceManagerPrefTest, GoodDisabledCipherSuites) { 79 TEST_F(SSLConfigServiceManagerPrefTest, GoodDisabledCipherSuites) {
80 TestingPrefServiceSimple local_state; 80 TestingPrefServiceSimple local_state;
81 SSLConfigServiceManager::RegisterPrefs(local_state.registry()); 81 SSLConfigServiceManager::RegisterPrefs(local_state.registry());
82 82
83 scoped_ptr<SSLConfigServiceManager> config_manager( 83 scoped_ptr<SSLConfigServiceManager> config_manager(
84 SSLConfigServiceManager::CreateDefaultManager(&local_state)); 84 SSLConfigServiceManager::CreateDefaultManager(&local_state));
85 ASSERT_TRUE(config_manager.get()); 85 ASSERT_TRUE(config_manager.get());
86 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); 86 scoped_refptr<SSLConfigService> config_service(config_manager->Get());
87 ASSERT_TRUE(config_service.get()); 87 ASSERT_TRUE(config_service.get());
88 88
89 SSLConfig old_config; 89 SSLConfig old_config;
90 config_service->GetSSLConfig(&old_config); 90 config_service->GetSSLConfig(&old_config);
91 EXPECT_TRUE(old_config.disabled_cipher_suites.empty()); 91 EXPECT_TRUE(old_config.disabled_cipher_suites.empty());
92 92
93 ListValue* list_value = new ListValue(); 93 base::ListValue* list_value = new base::ListValue();
94 list_value->Append(Value::CreateStringValue("0x0004")); 94 list_value->Append(base::Value::CreateStringValue("0x0004"));
95 list_value->Append(Value::CreateStringValue("0x0005")); 95 list_value->Append(base::Value::CreateStringValue("0x0005"));
96 local_state.SetUserPref(prefs::kCipherSuiteBlacklist, list_value); 96 local_state.SetUserPref(prefs::kCipherSuiteBlacklist, list_value);
97 97
98 // Pump the message loop to notify the SSLConfigServiceManagerPref that the 98 // Pump the message loop to notify the SSLConfigServiceManagerPref that the
99 // preferences changed. 99 // preferences changed.
100 message_loop_.RunUntilIdle(); 100 message_loop_.RunUntilIdle();
101 101
102 SSLConfig config; 102 SSLConfig config;
103 config_service->GetSSLConfig(&config); 103 config_service->GetSSLConfig(&config);
104 104
105 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites); 105 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites);
(...skipping 12 matching lines...) Expand all
118 scoped_ptr<SSLConfigServiceManager> config_manager( 118 scoped_ptr<SSLConfigServiceManager> config_manager(
119 SSLConfigServiceManager::CreateDefaultManager(&local_state)); 119 SSLConfigServiceManager::CreateDefaultManager(&local_state));
120 ASSERT_TRUE(config_manager.get()); 120 ASSERT_TRUE(config_manager.get());
121 scoped_refptr<SSLConfigService> config_service(config_manager->Get()); 121 scoped_refptr<SSLConfigService> config_service(config_manager->Get());
122 ASSERT_TRUE(config_service.get()); 122 ASSERT_TRUE(config_service.get());
123 123
124 SSLConfig old_config; 124 SSLConfig old_config;
125 config_service->GetSSLConfig(&old_config); 125 config_service->GetSSLConfig(&old_config);
126 EXPECT_TRUE(old_config.disabled_cipher_suites.empty()); 126 EXPECT_TRUE(old_config.disabled_cipher_suites.empty());
127 127
128 ListValue* list_value = new ListValue(); 128 base::ListValue* list_value = new base::ListValue();
129 list_value->Append(Value::CreateStringValue("0x0004")); 129 list_value->Append(base::Value::CreateStringValue("0x0004"));
130 list_value->Append(Value::CreateStringValue("TLS_NOT_WITH_A_CIPHER_SUITE")); 130 list_value->Append(
131 list_value->Append(Value::CreateStringValue("0x0005")); 131 base::Value::CreateStringValue("TLS_NOT_WITH_A_CIPHER_SUITE"));
132 list_value->Append(Value::CreateStringValue("0xBEEFY")); 132 list_value->Append(base::Value::CreateStringValue("0x0005"));
133 list_value->Append(base::Value::CreateStringValue("0xBEEFY"));
133 local_state.SetUserPref(prefs::kCipherSuiteBlacklist, list_value); 134 local_state.SetUserPref(prefs::kCipherSuiteBlacklist, list_value);
134 135
135 // Pump the message loop to notify the SSLConfigServiceManagerPref that the 136 // Pump the message loop to notify the SSLConfigServiceManagerPref that the
136 // preferences changed. 137 // preferences changed.
137 message_loop_.RunUntilIdle(); 138 message_loop_.RunUntilIdle();
138 139
139 SSLConfig config; 140 SSLConfig config;
140 config_service->GetSSLConfig(&config); 141 config_service->GetSSLConfig(&config);
141 142
142 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites); 143 EXPECT_NE(old_config.disabled_cipher_suites, config.disabled_cipher_suites);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 std::string version_max_str; 243 std::string version_max_str;
243 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin, 244 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMin,
244 &version_min_str)); 245 &version_min_str));
245 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax, 246 EXPECT_FALSE(local_state_store->GetString(prefs::kSSLVersionMax,
246 &version_max_str)); 247 &version_max_str));
247 bool unrestricted_ssl3_fallback_enabled; 248 bool unrestricted_ssl3_fallback_enabled;
248 EXPECT_FALSE(local_state_store->GetBoolean( 249 EXPECT_FALSE(local_state_store->GetBoolean(
249 prefs::kEnableUnrestrictedSSL3Fallback, 250 prefs::kEnableUnrestrictedSSL3Fallback,
250 &unrestricted_ssl3_fallback_enabled)); 251 &unrestricted_ssl3_fallback_enabled));
251 } 252 }
OLDNEW
« no previous file with comments | « chrome/browser/net/ssl_config_service_manager_pref.cc ('k') | chrome/browser/network_time/network_time_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698