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