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/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/prefs/command_line_pref_store.h" | 11 #include "chrome/browser/prefs/command_line_pref_store.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "components/proxy_config/proxy_config_dictionary.h" | 14 #include "components/proxy_config/proxy_config_dictionary.h" |
15 #include "components/proxy_config/proxy_config_pref_names.h" | 15 #include "components/proxy_config/proxy_config_pref_names.h" |
| 16 #include "components/ssl_config/ssl_config_prefs.h" |
16 #include "ui/base/ui_base_switches.h" | 17 #include "ui/base/ui_base_switches.h" |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 const char unknown_bool[] = "unknown_switch"; | 21 const char unknown_bool[] = "unknown_switch"; |
21 const char unknown_string[] = "unknown_other_switch"; | 22 const char unknown_string[] = "unknown_other_switch"; |
22 | 23 |
23 } // namespace | 24 } // namespace |
24 | 25 |
25 class TestCommandLinePrefStore : public CommandLinePrefStore { | 26 class TestCommandLinePrefStore : public CommandLinePrefStore { |
(...skipping 12 matching lines...) Expand all Loading... |
38 ProxyConfigDictionary dict( | 39 ProxyConfigDictionary dict( |
39 static_cast<const base::DictionaryValue*>(value)); | 40 static_cast<const base::DictionaryValue*>(value)); |
40 ProxyPrefs::ProxyMode actual_mode; | 41 ProxyPrefs::ProxyMode actual_mode; |
41 ASSERT_TRUE(dict.GetMode(&actual_mode)); | 42 ASSERT_TRUE(dict.GetMode(&actual_mode)); |
42 EXPECT_EQ(expected_mode, actual_mode); | 43 EXPECT_EQ(expected_mode, actual_mode); |
43 } | 44 } |
44 | 45 |
45 void VerifySSLCipherSuites(const char* const* ciphers, | 46 void VerifySSLCipherSuites(const char* const* ciphers, |
46 size_t cipher_count) { | 47 size_t cipher_count) { |
47 const base::Value* value = NULL; | 48 const base::Value* value = NULL; |
48 ASSERT_TRUE(GetValue(prefs::kCipherSuiteBlacklist, &value)); | 49 ASSERT_TRUE(GetValue(ssl_config::prefs::kCipherSuiteBlacklist, &value)); |
49 ASSERT_EQ(base::Value::TYPE_LIST, value->GetType()); | 50 ASSERT_EQ(base::Value::TYPE_LIST, value->GetType()); |
50 const base::ListValue* list_value = | 51 const base::ListValue* list_value = |
51 static_cast<const base::ListValue*>(value); | 52 static_cast<const base::ListValue*>(value); |
52 ASSERT_EQ(cipher_count, list_value->GetSize()); | 53 ASSERT_EQ(cipher_count, list_value->GetSize()); |
53 | 54 |
54 std::string cipher_string; | 55 std::string cipher_string; |
55 for (base::ListValue::const_iterator it = list_value->begin(); | 56 for (base::ListValue::const_iterator it = list_value->begin(); |
56 it != list_value->end(); ++it, ++ciphers) { | 57 it != list_value->end(); ++it, ++ciphers) { |
57 ASSERT_TRUE((*it)->GetAsString(&cipher_string)); | 58 ASSERT_TRUE((*it)->GetAsString(&cipher_string)); |
58 EXPECT_EQ(*ciphers, cipher_string); | 59 EXPECT_EQ(*ciphers, cipher_string); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist, | 212 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist, |
212 "0x0004;MOAR;0x0005"); | 213 "0x0004;MOAR;0x0005"); |
213 scoped_refptr<TestCommandLinePrefStore> store3 = | 214 scoped_refptr<TestCommandLinePrefStore> store3 = |
214 new TestCommandLinePrefStore(&cl3); | 215 new TestCommandLinePrefStore(&cl3); |
215 const char* const expected_ciphers3[] = { | 216 const char* const expected_ciphers3[] = { |
216 "0x0004;MOAR;0x0005" | 217 "0x0004;MOAR;0x0005" |
217 }; | 218 }; |
218 store3->VerifySSLCipherSuites(expected_ciphers3, | 219 store3->VerifySSLCipherSuites(expected_ciphers3, |
219 arraysize(expected_ciphers3)); | 220 arraysize(expected_ciphers3)); |
220 } | 221 } |
OLD | NEW |