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 #include <stddef.h> | 6 #include <stddef.h> |
7 | 7 |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 bool ProxySwitchesAreValid() { | 33 bool ProxySwitchesAreValid() { |
34 return ValidateProxySwitches(); | 34 return ValidateProxySwitches(); |
35 } | 35 } |
36 | 36 |
37 void VerifyProxyMode(ProxyPrefs::ProxyMode expected_mode) { | 37 void VerifyProxyMode(ProxyPrefs::ProxyMode expected_mode) { |
38 const base::Value* value = NULL; | 38 const base::Value* value = NULL; |
39 ASSERT_TRUE(GetValue(proxy_config::prefs::kProxy, &value)); | 39 ASSERT_TRUE(GetValue(proxy_config::prefs::kProxy, &value)); |
40 ASSERT_EQ(base::Value::Type::DICTIONARY, value->GetType()); | 40 ASSERT_EQ(base::Value::Type::DICTIONARY, value->GetType()); |
41 ProxyConfigDictionary dict( | 41 ProxyConfigDictionary dict( |
42 static_cast<const base::DictionaryValue*>(value)); | 42 static_cast<const base::DictionaryValue*>(value)->CreateDeepCopy()); |
43 ProxyPrefs::ProxyMode actual_mode; | 43 ProxyPrefs::ProxyMode actual_mode; |
44 ASSERT_TRUE(dict.GetMode(&actual_mode)); | 44 ASSERT_TRUE(dict.GetMode(&actual_mode)); |
45 EXPECT_EQ(expected_mode, actual_mode); | 45 EXPECT_EQ(expected_mode, actual_mode); |
46 } | 46 } |
47 | 47 |
48 void VerifySSLCipherSuites(const char* const* ciphers, | 48 void VerifySSLCipherSuites(const char* const* ciphers, |
49 size_t cipher_count) { | 49 size_t cipher_count) { |
50 const base::Value* value = NULL; | 50 const base::Value* value = NULL; |
51 ASSERT_TRUE(GetValue(ssl_config::prefs::kCipherSuiteBlacklist, &value)); | 51 ASSERT_TRUE(GetValue(ssl_config::prefs::kCipherSuiteBlacklist, &value)); |
52 ASSERT_EQ(base::Value::Type::LIST, value->GetType()); | 52 ASSERT_EQ(base::Value::Type::LIST, value->GetType()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 const base::Value* actual = NULL; | 116 const base::Value* actual = NULL; |
117 EXPECT_FALSE(store->GetValue(unknown_bool, &actual)); | 117 EXPECT_FALSE(store->GetValue(unknown_bool, &actual)); |
118 EXPECT_FALSE(store->GetValue(unknown_string, &actual)); | 118 EXPECT_FALSE(store->GetValue(unknown_string, &actual)); |
119 | 119 |
120 store->VerifyProxyMode(ProxyPrefs::MODE_FIXED_SERVERS); | 120 store->VerifyProxyMode(ProxyPrefs::MODE_FIXED_SERVERS); |
121 | 121 |
122 const base::Value* value = NULL; | 122 const base::Value* value = NULL; |
123 ASSERT_TRUE(store->GetValue(proxy_config::prefs::kProxy, &value)); | 123 ASSERT_TRUE(store->GetValue(proxy_config::prefs::kProxy, &value)); |
124 ASSERT_EQ(base::Value::Type::DICTIONARY, value->GetType()); | 124 ASSERT_EQ(base::Value::Type::DICTIONARY, value->GetType()); |
125 ProxyConfigDictionary dict(static_cast<const base::DictionaryValue*>(value)); | 125 ProxyConfigDictionary dict( |
| 126 static_cast<const base::DictionaryValue*>(value)->CreateDeepCopy()); |
126 | 127 |
127 std::string string_result; | 128 std::string string_result; |
128 | 129 |
129 ASSERT_TRUE(dict.GetProxyServer(&string_result)); | 130 ASSERT_TRUE(dict.GetProxyServer(&string_result)); |
130 EXPECT_EQ("proxy", string_result); | 131 EXPECT_EQ("proxy", string_result); |
131 | 132 |
132 ASSERT_TRUE(dict.GetBypassList(&string_result)); | 133 ASSERT_TRUE(dict.GetBypassList(&string_result)); |
133 EXPECT_EQ("list", string_result); | 134 EXPECT_EQ("list", string_result); |
134 } | 135 } |
135 | 136 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist, | 217 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist, |
217 "0x0004;MOAR;0x0005"); | 218 "0x0004;MOAR;0x0005"); |
218 scoped_refptr<TestCommandLinePrefStore> store3 = | 219 scoped_refptr<TestCommandLinePrefStore> store3 = |
219 new TestCommandLinePrefStore(&cl3); | 220 new TestCommandLinePrefStore(&cl3); |
220 const char* const expected_ciphers3[] = { | 221 const char* const expected_ciphers3[] = { |
221 "0x0004;MOAR;0x0005" | 222 "0x0004;MOAR;0x0005" |
222 }; | 223 }; |
223 store3->VerifySSLCipherSuites(expected_ciphers3, | 224 store3->VerifySSLCipherSuites(expected_ciphers3, |
224 arraysize(expected_ciphers3)); | 225 arraysize(expected_ciphers3)); |
225 } | 226 } |
OLD | NEW |