aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar tfarina <tfarina@chromium.org>2014-08-12 09:03:16 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-12 09:03:16 -0700
commit35fbd014e3dd2b4e1813389da6dfa2d3482dfb67 (patch)
tree31a602335328c5275303458186f09713eb3c4f24 /tests
parentb3c9d1c33caf325aada244204215eb790c228c12 (diff)
Migrate SkRTConfRegistry test to DEF_TEST().
BUG=None TEST=dm --tests=true --gms=false R=mtklein@google.com, bsalomon@google.com Author: tfarina@chromium.org Review URL: https://codereview.chromium.org/444303002
Diffstat (limited to 'tests')
-rw-r--r--tests/RTConfRegistryTest.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/tests/RTConfRegistryTest.cpp b/tests/RTConfRegistryTest.cpp
index f42281fa22..59fb3e9142 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);
+}