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 <gtest/gtest.h> | 5 #include <gtest/gtest.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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 EXPECT_FALSE(store->GetValue(unknown_bool, &actual)); | 109 EXPECT_FALSE(store->GetValue(unknown_bool, &actual)); |
110 EXPECT_FALSE(store->GetValue(unknown_string, &actual)); | 110 EXPECT_FALSE(store->GetValue(unknown_string, &actual)); |
111 | 111 |
112 store->VerifyProxyMode(ProxyPrefs::MODE_FIXED_SERVERS); | 112 store->VerifyProxyMode(ProxyPrefs::MODE_FIXED_SERVERS); |
113 | 113 |
114 const Value* value = NULL; | 114 const Value* value = NULL; |
115 ASSERT_TRUE(store->GetValue(prefs::kProxy, &value)); | 115 ASSERT_TRUE(store->GetValue(prefs::kProxy, &value)); |
116 ASSERT_EQ(Value::TYPE_DICTIONARY, value->GetType()); | 116 ASSERT_EQ(Value::TYPE_DICTIONARY, value->GetType()); |
117 ProxyConfigDictionary dict(static_cast<const DictionaryValue*>(value)); | 117 ProxyConfigDictionary dict(static_cast<const DictionaryValue*>(value)); |
118 | 118 |
119 std::string string_result = ""; | 119 std::string string_result; |
120 | 120 |
121 ASSERT_TRUE(dict.GetProxyServer(&string_result)); | 121 ASSERT_TRUE(dict.GetProxyServer(&string_result)); |
122 EXPECT_EQ("proxy", string_result); | 122 EXPECT_EQ("proxy", string_result); |
123 | 123 |
124 ASSERT_TRUE(dict.GetBypassList(&string_result)); | 124 ASSERT_TRUE(dict.GetBypassList(&string_result)); |
125 EXPECT_EQ("list", string_result); | 125 EXPECT_EQ("list", string_result); |
126 } | 126 } |
127 | 127 |
128 // Tests proxy switch validation. | 128 // Tests proxy switch validation. |
129 TEST(CommandLinePrefStoreTest, ProxySwitchValidation) { | 129 TEST(CommandLinePrefStoreTest, ProxySwitchValidation) { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 new TestCommandLinePrefStore(&cl1); | 165 new TestCommandLinePrefStore(&cl1); |
166 store1->VerifyProxyMode(ProxyPrefs::MODE_FIXED_SERVERS); | 166 store1->VerifyProxyMode(ProxyPrefs::MODE_FIXED_SERVERS); |
167 | 167 |
168 CommandLine cl2(CommandLine::NO_PROGRAM); | 168 CommandLine cl2(CommandLine::NO_PROGRAM); |
169 cl2.AppendSwitchASCII(switches::kProxyPacUrl, "proxy"); | 169 cl2.AppendSwitchASCII(switches::kProxyPacUrl, "proxy"); |
170 scoped_refptr<TestCommandLinePrefStore> store2 = | 170 scoped_refptr<TestCommandLinePrefStore> store2 = |
171 new TestCommandLinePrefStore(&cl2); | 171 new TestCommandLinePrefStore(&cl2); |
172 store2->VerifyProxyMode(ProxyPrefs::MODE_PAC_SCRIPT); | 172 store2->VerifyProxyMode(ProxyPrefs::MODE_PAC_SCRIPT); |
173 | 173 |
174 CommandLine cl3(CommandLine::NO_PROGRAM); | 174 CommandLine cl3(CommandLine::NO_PROGRAM); |
175 cl3.AppendSwitchASCII(switches::kProxyServer, ""); | 175 cl3.AppendSwitchASCII(switches::kProxyServer, std::string()); |
176 scoped_refptr<TestCommandLinePrefStore> store3 = | 176 scoped_refptr<TestCommandLinePrefStore> store3 = |
177 new TestCommandLinePrefStore(&cl3); | 177 new TestCommandLinePrefStore(&cl3); |
178 store3->VerifyProxyMode(ProxyPrefs::MODE_DIRECT); | 178 store3->VerifyProxyMode(ProxyPrefs::MODE_DIRECT); |
179 } | 179 } |
180 | 180 |
181 TEST(CommandLinePrefStoreTest, DisableSSLCipherSuites) { | 181 TEST(CommandLinePrefStoreTest, DisableSSLCipherSuites) { |
182 CommandLine cl1(CommandLine::NO_PROGRAM); | 182 CommandLine cl1(CommandLine::NO_PROGRAM); |
183 cl1.AppendSwitchASCII(switches::kCipherSuiteBlacklist, | 183 cl1.AppendSwitchASCII(switches::kCipherSuiteBlacklist, |
184 "0x0004,0x0005"); | 184 "0x0004,0x0005"); |
185 scoped_refptr<TestCommandLinePrefStore> store1 = | 185 scoped_refptr<TestCommandLinePrefStore> store1 = |
186 new TestCommandLinePrefStore(&cl1); | 186 new TestCommandLinePrefStore(&cl1); |
187 const char* const expected_ciphers1[] = { | 187 const char* const expected_ciphers1[] = { |
(...skipping 20 matching lines...) Expand all Loading... |
208 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist, | 208 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist, |
209 "0x0004;MOAR;0x0005"); | 209 "0x0004;MOAR;0x0005"); |
210 scoped_refptr<TestCommandLinePrefStore> store3 = | 210 scoped_refptr<TestCommandLinePrefStore> store3 = |
211 new TestCommandLinePrefStore(&cl3); | 211 new TestCommandLinePrefStore(&cl3); |
212 const char* const expected_ciphers3[] = { | 212 const char* const expected_ciphers3[] = { |
213 "0x0004;MOAR;0x0005" | 213 "0x0004;MOAR;0x0005" |
214 }; | 214 }; |
215 store3->VerifySSLCipherSuites(expected_ciphers3, | 215 store3->VerifySSLCipherSuites(expected_ciphers3, |
216 arraysize(expected_ciphers3)); | 216 arraysize(expected_ciphers3)); |
217 } | 217 } |
OLD | NEW |