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

Side by Side Diff: chrome/browser/prefs/chrome_command_line_pref_store_unittest.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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
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 <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 19 matching lines...) Expand all
30 explicit TestCommandLinePrefStore(base::CommandLine* cl) 30 explicit TestCommandLinePrefStore(base::CommandLine* cl)
31 : ChromeCommandLinePrefStore(cl) {} 31 : ChromeCommandLinePrefStore(cl) {}
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));
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());
53 const base::ListValue* list_value = 53 const base::ListValue* list_value =
54 static_cast<const base::ListValue*>(value); 54 static_cast<const base::ListValue*>(value);
55 ASSERT_EQ(cipher_count, list_value->GetSize()); 55 ASSERT_EQ(cipher_count, list_value->GetSize());
56 56
57 std::string cipher_string; 57 std::string cipher_string;
58 for (base::ListValue::const_iterator it = list_value->begin(); 58 for (base::ListValue::const_iterator it = list_value->begin();
59 it != list_value->end(); ++it, ++ciphers) { 59 it != list_value->end(); ++it, ++ciphers) {
60 ASSERT_TRUE((*it)->GetAsString(&cipher_string)); 60 ASSERT_TRUE((*it)->GetAsString(&cipher_string));
61 EXPECT_EQ(*ciphers, cipher_string); 61 EXPECT_EQ(*ciphers, cipher_string);
62 } 62 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 new TestCommandLinePrefStore(&cl); 114 new TestCommandLinePrefStore(&cl);
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(static_cast<const base::DictionaryValue*>(value));
126 126
127 std::string string_result; 127 std::string string_result;
128 128
129 ASSERT_TRUE(dict.GetProxyServer(&string_result)); 129 ASSERT_TRUE(dict.GetProxyServer(&string_result));
130 EXPECT_EQ("proxy", string_result); 130 EXPECT_EQ("proxy", string_result);
131 131
132 ASSERT_TRUE(dict.GetBypassList(&string_result)); 132 ASSERT_TRUE(dict.GetBypassList(&string_result));
133 EXPECT_EQ("list", string_result); 133 EXPECT_EQ("list", string_result);
134 } 134 }
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist, 216 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist,
217 "0x0004;MOAR;0x0005"); 217 "0x0004;MOAR;0x0005");
218 scoped_refptr<TestCommandLinePrefStore> store3 = 218 scoped_refptr<TestCommandLinePrefStore> store3 =
219 new TestCommandLinePrefStore(&cl3); 219 new TestCommandLinePrefStore(&cl3);
220 const char* const expected_ciphers3[] = { 220 const char* const expected_ciphers3[] = {
221 "0x0004;MOAR;0x0005" 221 "0x0004;MOAR;0x0005"
222 }; 222 };
223 store3->VerifySSLCipherSuites(expected_ciphers3, 223 store3->VerifySSLCipherSuites(expected_ciphers3,
224 arraysize(expected_ciphers3)); 224 arraysize(expected_ciphers3));
225 } 225 }
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_browsertest.cc ('k') | chrome/browser/prefs/chrome_pref_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698