Reverted r10654 (Fix crash when querying a runtime config that is defined in environm...
authorrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Sun, 11 Aug 2013 13:20:18 +0000 (13:20 +0000)
committerrobertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Sun, 11 Aug 2013 13:20:18 +0000 (13:20 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@10669 2bbb7eff-a529-9590-31e7-b0007b416f81

gyp/tests.gyp
include/utils/SkRTConf.h
src/utils/SkRTConf.cpp
tests/UnitTestTest.cpp [deleted file]

index 9062446c73ec6817336195d847f4460b7d4c2e10..f58b0abff027c623e7ba6e33fe5fb214c9109c90 100644 (file)
         '../tests/TSetTest.cpp',
         '../tests/ToUnicode.cpp',
         '../tests/UnicodeTest.cpp',
-        '../tests/UnitTestTest.cpp',
         '../tests/UtilsTest.cpp',
         '../tests/WArrayTest.cpp',
         '../tests/WritePixelsTest.cpp',
index dc1f461b110a417f75113305ff26ebfa097e5e01..ea6e99ed891ec35e17b091f08d9f2e31e2100617 100644 (file)
@@ -73,9 +73,6 @@ public:
     void possiblyDumpFile() const;
     void validate() const;
     template <typename T> void set(const char *confname, T value);
-#ifdef SK_SUPPORT_UNITTEST
-    static void UnitTest();
-#endif
 private:
     template<typename T> friend class SkRTConf;
 
@@ -85,9 +82,6 @@ private:
     SkTDArray<SkString *> fConfigFileKeys, fConfigFileValues;
     typedef SkTDict< SkTDArray<SkRTConfBase *> * > ConfMap;
     ConfMap fConfs;
-#ifdef SK_SUPPORT_UNITTEST
-    SkRTConfRegistry(bool);
-#endif
 };
 
 // our singleton registry
index 18b7ca32bbcacd52b99411f0f934ba924d40d89d..e0977fe42f21e39a21a04909610853dc0fdb9cc3 100644 (file)
@@ -214,7 +214,6 @@ static inline void str_replace(char *s, char search, char replace) {
 
 template<typename T> bool SkRTConfRegistry::parse(const char *name, T* value) {
     SkString *str = NULL;
-    SkString tmp;
 
     for (int i = fConfigFileKeys.count() - 1 ; i >= 0; i--) {
         if (fConfigFileKeys[i]->equals(name)) {
@@ -228,9 +227,6 @@ template<typename T> bool SkRTConfRegistry::parse(const char *name, T* value) {
 
     const char *environment_value = getenv(environment_variable.c_str());
     if (environment_value) {
-        if (NULL == str) {
-            str = &tmp;
-        }
         str->set(environment_value);
     } else {
         // apparently my shell doesn't let me have environment variables that
@@ -242,9 +238,6 @@ template<typename T> bool SkRTConfRegistry::parse(const char *name, T* value) {
         sk_free(underscore_name);
         environment_value = getenv(underscore_environment_variable.c_str());
         if (environment_value) {
-            if (NULL == str) {
-                str = &tmp;
-            }
             str->set(environment_value);
         }
     }
@@ -301,18 +294,3 @@ SkRTConfRegistry &skRTConfRegistry() {
     static SkRTConfRegistry r;
     return r;
 }
-
-#ifdef SK_SUPPORT_UNITTEST
-void SkRTConfRegistry::UnitTest() {
-    SkRTConfRegistry registryWithoutContents(true);
-
-    setenv("skia_nonexistent_item", "132", 1);
-    int result = 0;
-    registryWithoutContents.parse("nonexistent.item", &result);
-    SkASSERT(result == 132);
-}
-
-SkRTConfRegistry::SkRTConfRegistry(bool)
-    : fConfs(100) {
-}
-#endif
diff --git a/tests/UnitTestTest.cpp b/tests/UnitTestTest.cpp
deleted file mode 100644 (file)
index e3e1b97..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2013 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkRTConf.h"
-#include "Test.h"
-
-static void test_runUnitTests(skiatest::Reporter* reporter) {
-#ifdef SK_SUPPORT_UNITTEST
-    SkRTConfRegistry::UnitTest();
-#endif
-}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS("UnitTest", UnitTestTestClass, test_runUnitTests)