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

Unified Diff: net/proxy/proxy_config_service_linux_unittest.cc

Issue 7033040: Linux: split ProxyConfigServiceLinux::SettingGetter::Setting into several enums. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/proxy_config_service_linux_unittest.cc
===================================================================
--- net/proxy/proxy_config_service_linux_unittest.cc (revision 86141)
+++ net/proxy/proxy_config_service_linux_unittest.cc (working copy)
@@ -63,13 +63,12 @@
// Mapping from a setting name to the location of the corresponding
// value (inside a EnvVarValues or GConfValues struct).
-template<typename value_type>
+template<typename key_type, typename value_type>
struct SettingsTable {
- typedef ProxyConfigServiceLinux::SettingGetter::Setting Setting;
- typedef std::map<Setting, value_type*> map_type;
+ typedef std::map<key_type, value_type*> map_type;
// Gets the value from its location
- value_type Get(Setting key) {
+ value_type Get(key_type key) {
typename map_type::const_iterator it = settings.find(key);
// In case there's a typo or the unittest becomes out of sync.
CHECK(it != settings.end()) << "key " << key << " not found";
@@ -193,7 +192,7 @@
return "test";
}
- virtual bool GetString(Setting key, std::string* result) {
+ virtual bool GetString(StringSetting key, std::string* result) {
const char* value = strings_table.Get(key);
if (value) {
*result = value;
@@ -202,13 +201,7 @@
return false;
}
- virtual bool GetInt(Setting key, int* result) {
- // We don't bother to distinguish unset keys from 0 values.
- *result = ints_table.Get(key);
- return true;
- }
-
- virtual bool GetBool(Setting key, bool* result) {
+ virtual bool GetBool(BoolSetting key, bool* result) {
BoolSettingValue value = bools_table.Get(key);
switch (value) {
case UNSET:
@@ -222,7 +215,14 @@
return true;
}
- virtual bool GetStringList(Setting key, std::vector<std::string>* result) {
+ virtual bool GetInt(IntSetting key, int* result) {
+ // We don't bother to distinguish unset keys from 0 values.
+ *result = ints_table.Get(key);
+ return true;
+ }
+
+ virtual bool GetStringList(StringListSetting key,
+ std::vector<std::string>* result) {
*result = string_lists_table.Get(key);
// We don't bother to distinguish unset keys from empty lists.
return !result->empty();
@@ -240,10 +240,11 @@
GConfValues values;
private:
- SettingsTable<const char*> strings_table;
- SettingsTable<int> ints_table;
- SettingsTable<BoolSettingValue> bools_table;
- SettingsTable<std::vector<std::string> > string_lists_table;
+ SettingsTable<StringSetting, const char*> strings_table;
+ SettingsTable<BoolSetting, BoolSettingValue> bools_table;
+ SettingsTable<IntSetting, int> ints_table;
+ SettingsTable<StringListSetting,
+ std::vector<std::string> > string_lists_table;
};
} // namespace
« no previous file with comments | « net/proxy/proxy_config_service_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698