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

Unified Diff: tests/RTConfRegistryTest.cpp

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/SkRTConf.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RTConfRegistryTest.cpp
diff --git a/tests/RTConfRegistryTest.cpp b/tests/RTConfRegistryTest.cpp
index f42281fa22f9bb75aa8e31aa3b5807b495b07556..59fb3e9142c81f8b1692738d1fdacac6bdda77ed 100644
--- a/tests/RTConfRegistryTest.cpp
+++ b/tests/RTConfRegistryTest.cpp
@@ -8,8 +8,25 @@
#include "SkRTConf.h"
#include "Test.h"
-DEF_TEST(SkRTConfRegistry, reporter) {
-#ifdef SK_SUPPORT_UNITTEST
- SkRTConfRegistry::UnitTest();
+// Friended proxy for SkRTConfRegistry::parse()
+template <typename T>
+bool test_rt_conf_parse(SkRTConfRegistry* reg, const char* key, T* value) {
+ return reg->parse(key, value);
+}
+
+static void portable_setenv(const char* key, const char* value) {
+#ifdef SK_BUILD_FOR_WIN32
+ _putenv_s(key, value);
+#else
+ setenv(key, value, 1);
#endif
}
+
+DEF_TEST(SkRTConfRegistry, reporter) {
+ SkRTConfRegistry reg;
+
+ portable_setenv("skia_nonexistent_item", "132");
+ int result = 0;
+ test_rt_conf_parse(&reg, "nonexistent.item", &result);
+ REPORTER_ASSERT(reporter, result == 132);
+}
« no previous file with comments | « src/utils/SkRTConf.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698