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

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

Issue 10068036: RefCounted types should not have public destructors, chrome/browser/ part 5 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix Created 8 years, 8 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "chrome/browser/prefs/command_line_pref_store.h" 11 #include "chrome/browser/prefs/command_line_pref_store.h"
12 #include "chrome/browser/prefs/proxy_config_dictionary.h" 12 #include "chrome/browser/prefs/proxy_config_dictionary.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "ui/base/ui_base_switches.h" 15 #include "ui/base/ui_base_switches.h"
16 16
17 namespace { 17 namespace {
18 18
19 const char unknown_bool[] = "unknown_switch";
20 const char unknown_string[] = "unknown_other_switch";
21
22 } // namespace
23
19 class TestCommandLinePrefStore : public CommandLinePrefStore { 24 class TestCommandLinePrefStore : public CommandLinePrefStore {
20 public: 25 public:
21 explicit TestCommandLinePrefStore(CommandLine* cl) 26 explicit TestCommandLinePrefStore(CommandLine* cl)
22 : CommandLinePrefStore(cl) {} 27 : CommandLinePrefStore(cl) {}
23 28
24 bool ProxySwitchesAreValid() { 29 bool ProxySwitchesAreValid() {
25 return ValidateProxySwitches(); 30 return ValidateProxySwitches();
26 } 31 }
27 32
28 void VerifyProxyMode(ProxyPrefs::ProxyMode expected_mode) { 33 void VerifyProxyMode(ProxyPrefs::ProxyMode expected_mode) {
(...skipping 15 matching lines...) Expand all
44 const ListValue* list_value = static_cast<const ListValue*>(value); 49 const ListValue* list_value = static_cast<const ListValue*>(value);
45 ASSERT_EQ(cipher_count, list_value->GetSize()); 50 ASSERT_EQ(cipher_count, list_value->GetSize());
46 51
47 std::string cipher_string; 52 std::string cipher_string;
48 for (ListValue::const_iterator it = list_value->begin(); 53 for (ListValue::const_iterator it = list_value->begin();
49 it != list_value->end(); ++it, ++ciphers) { 54 it != list_value->end(); ++it, ++ciphers) {
50 ASSERT_TRUE((*it)->GetAsString(&cipher_string)); 55 ASSERT_TRUE((*it)->GetAsString(&cipher_string));
51 EXPECT_EQ(*ciphers, cipher_string); 56 EXPECT_EQ(*ciphers, cipher_string);
52 } 57 }
53 } 58 }
59
60 private:
61 virtual ~TestCommandLinePrefStore() {}
54 }; 62 };
55 63
56 const char unknown_bool[] = "unknown_switch";
57 const char unknown_string[] = "unknown_other_switch";
58
59 } // namespace
60
61 // Tests a simple string pref on the command line. 64 // Tests a simple string pref on the command line.
62 TEST(CommandLinePrefStoreTest, SimpleStringPref) { 65 TEST(CommandLinePrefStoreTest, SimpleStringPref) {
63 CommandLine cl(CommandLine::NO_PROGRAM); 66 CommandLine cl(CommandLine::NO_PROGRAM);
64 cl.AppendSwitchASCII(switches::kLang, "hi-MOM"); 67 cl.AppendSwitchASCII(switches::kLang, "hi-MOM");
65 scoped_refptr<CommandLinePrefStore> store = new CommandLinePrefStore(&cl); 68 scoped_refptr<CommandLinePrefStore> store = new CommandLinePrefStore(&cl);
66 69
67 const Value* actual = NULL; 70 const Value* actual = NULL;
68 EXPECT_EQ(PrefStore::READ_OK, 71 EXPECT_EQ(PrefStore::READ_OK,
69 store->GetValue(prefs::kApplicationLocale, &actual)); 72 store->GetValue(prefs::kApplicationLocale, &actual));
70 std::string result; 73 std::string result;
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist, 210 cl3.AppendSwitchASCII(switches::kCipherSuiteBlacklist,
208 "0x0004;MOAR;0x0005"); 211 "0x0004;MOAR;0x0005");
209 scoped_refptr<TestCommandLinePrefStore> store3 = 212 scoped_refptr<TestCommandLinePrefStore> store3 =
210 new TestCommandLinePrefStore(&cl3); 213 new TestCommandLinePrefStore(&cl3);
211 const char* const expected_ciphers3[] = { 214 const char* const expected_ciphers3[] = {
212 "0x0004;MOAR;0x0005" 215 "0x0004;MOAR;0x0005"
213 }; 216 };
214 store3->VerifySSLCipherSuites(expected_ciphers3, 217 store3->VerifySSLCipherSuites(expected_ciphers3,
215 arraysize(expected_ciphers3)); 218 arraysize(expected_ciphers3));
216 } 219 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/command_line_pref_store.cc ('k') | chrome/browser/prefs/default_pref_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698