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 isThreadsafe() const { return !this->isGPUTest(); } |
| 68 |
| 69 virtual bool isGPUTest() const { return false; } |
68 | 70 |
69 protected: | 71 protected: |
70 virtual void onGetName(SkString*) = 0; | 72 virtual void onGetName(SkString*) = 0; |
71 virtual void onRun(Reporter*) = 0; | 73 virtual void onRun(Reporter*) = 0; |
72 | 74 |
73 private: | 75 private: |
74 Reporter* fReporter; | 76 Reporter* fReporter; |
75 SkString fName; | 77 SkString fName; |
76 bool fPassed; | 78 bool fPassed; |
77 SkMSec fElapsed; | 79 SkMSec fElapsed; |
78 }; | 80 }; |
79 | 81 |
80 class GpuTest : public Test{ | 82 class GpuTest : public Test{ |
81 public: | 83 public: |
82 GpuTest() : Test() {} | 84 GpuTest() : Test() {} |
83 static GrContextFactory* GetGrContextFactory(); | 85 static GrContextFactory* GetGrContextFactory(); |
84 static void DestroyContexts(); | 86 static void DestroyContexts(); |
85 virtual bool isThreadsafe() const { return false; } | 87 virtual bool isGPUTest() const { return true; } |
86 private: | 88 private: |
87 }; | 89 }; |
88 | 90 |
89 typedef SkTRegistry<Test*(*)(void*)> TestRegistry; | 91 typedef SkTRegistry<Test*(*)(void*)> TestRegistry; |
90 } // namespace skiatest | 92 } // namespace skiatest |
91 | 93 |
92 /* | 94 /* |
93 Use the following macros to make use of the skiatest classes, e.g. | 95 Use the following macros to make use of the skiatest classes, e.g. |
94 | 96 |
95 #include "Test.h" | 97 #include "Test.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 } \ | 165 } \ |
164 virtual void onRun(Reporter* r) SK_OVERRIDE { \ | 166 virtual void onRun(Reporter* r) SK_OVERRIDE { \ |
165 name(r, GetGrContextFactory()); \ | 167 name(r, GetGrContextFactory()); \ |
166 } \ | 168 } \ |
167 }; \ | 169 }; \ |
168 static TestRegistry gReg_##name##Class(name##Class::Factory); \ | 170 static TestRegistry gReg_##name##Class(name##Class::Factory); \ |
169 } \ | 171 } \ |
170 static void name(skiatest::Reporter* reporter, GrContextFactory* factory) | 172 static void name(skiatest::Reporter* reporter, GrContextFactory* factory) |
171 | 173 |
172 #endif | 174 #endif |
OLD | NEW |