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

Side by Side Diff: include/utils/SkRTConf.h

Issue 444303002: Migrate SkRTConfRegistry test to DEF_TEST(). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: mtklein changes Created 6 years, 4 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
« no previous file with comments | « no previous file | src/utils/SkRTConf.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google, Inc. 2 * Copyright 2013 Google, Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 8
9 #ifndef SkRTConf_DEFINED 9 #ifndef SkRTConf_DEFINED
10 #define SkRTConf_DEFINED 10 #define SkRTConf_DEFINED
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 ~SkRTConfRegistry(); 77 ~SkRTConfRegistry();
78 void printAll(const char *fname = NULL) const; 78 void printAll(const char *fname = NULL) const;
79 bool hasNonDefault() const; 79 bool hasNonDefault() const;
80 void printNonDefault(const char *fname = NULL) const; 80 void printNonDefault(const char *fname = NULL) const;
81 const char *configFileLocation() const; 81 const char *configFileLocation() const;
82 void possiblyDumpFile() const; 82 void possiblyDumpFile() const;
83 void validate() const; 83 void validate() const;
84 template <typename T> void set(const char *confname, 84 template <typename T> void set(const char *confname,
85 T value, 85 T value,
86 bool warnIfNotFound = true); 86 bool warnIfNotFound = true);
87 #ifdef SK_SUPPORT_UNITTEST 87
88 static void UnitTest();
89 #endif
90 private: 88 private:
91 template<typename T> friend class SkRTConf; 89 template<typename T> friend class SkRTConf;
92 90
93 void registerConf(SkRTConfBase *conf); 91 void registerConf(SkRTConfBase *conf);
92
94 template <typename T> bool parse(const char *name, T* value); 93 template <typename T> bool parse(const char *name, T* value);
95 94
96 SkTDArray<SkString *> fConfigFileKeys, fConfigFileValues; 95 SkTDArray<SkString *> fConfigFileKeys, fConfigFileValues;
97 typedef SkTDict< SkTDArray<SkRTConfBase *> * > ConfMap; 96 typedef SkTDict< SkTDArray<SkRTConfBase *> * > ConfMap;
98 ConfMap fConfs; 97 ConfMap fConfs;
99 #ifdef SK_SUPPORT_UNITTEST 98
100 SkRTConfRegistry(bool); 99 template <typename T>
101 #endif 100 friend bool test_rt_conf_parse(SkRTConfRegistry*, const char* name, T* value );
102 }; 101 };
103 102
104 // our singleton registry 103 // our singleton registry
105 104
106 SkRTConfRegistry &skRTConfRegistry(); 105 SkRTConfRegistry &skRTConfRegistry();
107 106
108 template<typename T> 107 template<typename T>
109 SkRTConf<T>::SkRTConf(const char *name, const T &defaultValue, const char *descr iption) 108 SkRTConf<T>::SkRTConf(const char *name, const T &defaultValue, const char *descr iption)
110 : SkRTConfBase(name) 109 : SkRTConfBase(name)
111 , fValue(defaultValue) 110 , fValue(defaultValue)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // static_cast here is okay because there's only one kind of child class. 185 // static_cast here is okay because there's only one kind of child class.
187 const SkRTConf<T> *child_pointer = static_cast<const SkRTConf<T> *>(conf); 186 const SkRTConf<T> *child_pointer = static_cast<const SkRTConf<T> *>(conf);
188 return child_pointer && 187 return child_pointer &&
189 fName == child_pointer->fName && 188 fName == child_pointer->fName &&
190 fDescription == child_pointer->fDescription && 189 fDescription == child_pointer->fDescription &&
191 fValue == child_pointer->fValue && 190 fValue == child_pointer->fValue &&
192 fDefault == child_pointer->fDefault; 191 fDefault == child_pointer->fDefault;
193 } 192 }
194 193
195 #endif 194 #endif
OLDNEW
« no previous file with comments | « no previous file | src/utils/SkRTConf.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698