Add --threads to tests binary, to run non-GPU tests on multiple cores.

On my quad-core laptop I can get about a 3x speedup:
  Debug,   --threads 0  40.99s
  Debug,   --threads 8  14.39s
  Release, --threads 0   8.24s
  Release, --threads 8   2.80s

I also removed some unused Test.{h,cpp} APIs and refactored a little to make
things thread-safer.

BUG=
R=borenet@google.com, djsollen@google.com, scroggo@google.com, reed@google.com

Author: mtklein@google.com

Review URL: https://chromiumcodereview.appspot.com/13855007

git-svn-id: http://skia.googlecode.com/svn/trunk@8763 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/Test.h b/tests/Test.h
index 6b0b901..1aa0387 100644
--- a/tests/Test.h
+++ b/tests/Test.h
@@ -31,13 +31,8 @@
             kLastResult = kFailed
         };
 
-        void resetReporting();
         void bumpTestCount() { sk_atomic_inc(&fTestCount); }
         int countTests() const { return fTestCount; }
-        int countResults(Result r) {
-            SkASSERT((unsigned)r <= kLastResult);
-            return fResultCount[r];
-        }
 
         void startTest(Test*);
         void report(const char testDesc[], Result);
@@ -45,16 +40,6 @@
         virtual bool allowExtendedTest() const { return false; }
         virtual bool allowThreaded() const { return false; }
         // helpers for tests
-        void assertTrue(bool cond, const char desc[]) {
-            if (!cond) {
-                this->report(desc, kFailed);
-            }
-        }
-        void assertFalse(bool cond, const char desc[]) {
-            if (cond) {
-                this->report(desc, kFailed);
-            }
-        }
         void reportFailed(const char desc[]) {
             this->report(desc, kFailed);
         }
@@ -62,9 +47,6 @@
             this->report(desc.c_str(), kFailed);
         }
 
-        bool getCurrSuccess() const {
-            return fCurrTestSuccess;
-        }
 
     protected:
         virtual void onStart(Test*) {}
@@ -72,10 +54,7 @@
         virtual void onEnd(Test*) {}
 
     private:
-        Test* fCurrTest;
-        int fTestCount;
-        int fResultCount[kLastResult+1];
-        bool fCurrTestSuccess;
+        int32_t fTestCount;
 
         typedef SkRefCnt INHERITED;
     };
@@ -89,12 +68,15 @@
         void setReporter(Reporter*);
 
         const char* getName();
-        bool run(); // returns true on success
+        void run();
+        bool passed() const { return fPassed; }
 
         static const SkString& GetTmpDir();
 
         static const SkString& GetResourcePath();
 
+        virtual bool isThreadsafe() const { return true; }
+
     protected:
         virtual void onGetName(SkString*) = 0;
         virtual void onRun(Reporter*) = 0;
@@ -102,6 +84,7 @@
     private:
         Reporter*   fReporter;
         SkString    fName;
+        bool        fPassed;
     };
 
     class GpuTest : public Test{
@@ -109,6 +92,7 @@
         GpuTest() : Test() {}
         static GrContextFactory* GetGrContextFactory();
         static void DestroyContexts();
+        virtual bool isThreadsafe() const { return false; }
     private:
     };