OLD | NEW |
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 #include "SkRTConf.h" | 8 #include "SkRTConf.h" |
9 #include "Test.h" | 9 #include "Test.h" |
10 | 10 |
11 DEF_TEST(SkRTConfRegistry, reporter) { | 11 // Friended proxy for SkRTConfRegistry::parse() |
12 #ifdef SK_SUPPORT_UNITTEST | 12 template <typename T> |
13 SkRTConfRegistry::UnitTest(); | 13 bool test_rt_conf_parse(SkRTConfRegistry* reg, const char* key, T* value) { |
| 14 return reg->parse(key, value); |
| 15 } |
| 16 |
| 17 static void portable_setenv(const char* key, const char* value) { |
| 18 #ifdef SK_BUILD_FOR_WIN32 |
| 19 _putenv_s(key, value); |
| 20 #else |
| 21 setenv(key, value, 1); |
14 #endif | 22 #endif |
15 } | 23 } |
| 24 |
| 25 DEF_TEST(SkRTConfRegistry, reporter) { |
| 26 SkRTConfRegistry reg; |
| 27 |
| 28 portable_setenv("skia_nonexistent_item", "132"); |
| 29 int result = 0; |
| 30 test_rt_conf_parse(®, "nonexistent.item", &result); |
| 31 REPORTER_ASSERT(reporter, result == 132); |
| 32 } |
OLD | NEW |