OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #ifndef skiatest_Test_DEFINED | 8 #ifndef skiatest_Test_DEFINED |
9 #define skiatest_Test_DEFINED | 9 #define skiatest_Test_DEFINED |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 const char* getName(); | 58 const char* getName(); |
59 void run(); | 59 void run(); |
60 bool passed() const { return fPassed; } | 60 bool passed() const { return fPassed; } |
61 SkMSec elapsedMs() const { return fElapsed; } | 61 SkMSec elapsedMs() const { return fElapsed; } |
62 | 62 |
63 static SkString GetTmpDir(); | 63 static SkString GetTmpDir(); |
64 | 64 |
65 static SkString GetResourcePath(); | 65 static SkString GetResourcePath(); |
66 | 66 |
67 virtual bool isThreadsafe() const { return true; } | 67 virtual bool isGPUTest() const { return false; } |
68 | 68 |
69 protected: | 69 protected: |
70 virtual void onGetName(SkString*) = 0; | 70 virtual void onGetName(SkString*) = 0; |
71 virtual void onRun(Reporter*) = 0; | 71 virtual void onRun(Reporter*) = 0; |
72 | 72 |
73 private: | 73 private: |
74 Reporter* fReporter; | 74 Reporter* fReporter; |
75 SkString fName; | 75 SkString fName; |
76 bool fPassed; | 76 bool fPassed; |
77 SkMSec fElapsed; | 77 SkMSec fElapsed; |
78 }; | 78 }; |
79 | 79 |
80 class GpuTest : public Test{ | 80 class GpuTest : public Test{ |
81 public: | 81 public: |
82 GpuTest() : Test() {} | 82 GpuTest() : Test() {} |
83 static GrContextFactory* GetGrContextFactory(); | 83 static GrContextFactory* GetGrContextFactory(); |
84 static void DestroyContexts(); | 84 static void DestroyContexts(); |
85 virtual bool isThreadsafe() const { return false; } | 85 virtual bool isGPUTest() const { return true; } |
86 private: | 86 private: |
87 }; | 87 }; |
88 | 88 |
89 typedef SkTRegistry<Test*(*)(void*)> TestRegistry; | 89 typedef SkTRegistry<Test*(*)(void*)> TestRegistry; |
90 } // namespace skiatest | 90 } // namespace skiatest |
91 | 91 |
92 /* | 92 /* |
93 Use the following macros to make use of the skiatest classes, e.g. | 93 Use the following macros to make use of the skiatest classes, e.g. |
94 | 94 |
95 #include "Test.h" | 95 #include "Test.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } \ | 163 } \ |
164 virtual void onRun(Reporter* r) SK_OVERRIDE { \ | 164 virtual void onRun(Reporter* r) SK_OVERRIDE { \ |
165 name(r, GetGrContextFactory()); \ | 165 name(r, GetGrContextFactory()); \ |
166 } \ | 166 } \ |
167 }; \ | 167 }; \ |
168 static TestRegistry gReg_##name##Class(name##Class::Factory); \ | 168 static TestRegistry gReg_##name##Class(name##Class::Factory); \ |
169 } \ | 169 } \ |
170 static void name(skiatest::Reporter* reporter, GrContextFactory* factory) | 170 static void name(skiatest::Reporter* reporter, GrContextFactory* factory) |
171 | 171 |
172 #endif | 172 #endif |
OLD | NEW |