Make program unit test run clean and add it to tests program

Review URL: http://codereview.appspot.com/4898049/


git-svn-id: http://skia.googlecode.com/svn/trunk@2121 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/TestClassDef.h b/tests/TestClassDef.h
index ce9cff4..34f899f 100644
--- a/tests/TestClassDef.h
+++ b/tests/TestClassDef.h
@@ -29,3 +29,16 @@
         static TestRegistry gReg(classname::Factory);                       \
     }
 
+#define DEFINE_GPUTESTCLASS(uiname, classname, function)                    \
+    namespace skiatest {                                                    \
+        class classname : public GpuTest {                                  \
+        public:                                                             \
+            static Test* Factory(void*) { return SkNEW(classname); }        \
+        protected:                                                          \
+            virtual void onGetName(SkString* name) { name->set(uiname); }   \
+            virtual void onRun(Reporter* reporter) {                        \
+                function(reporter, fContext);                               \
+            }                                                               \
+        };                                                                  \
+        static TestRegistry gReg(classname::Factory);                       \
+    }