Chromium Code Reviews| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 true; } |
| 68 | 68 |
| 69 virtual bool isGPUTest() const { return false; } | |
|
mtklein
2014/01/27 22:35:29
Can you fold isThreadsafe and this together? isTh
borenet
2014/01/28 18:42:09
Done.
| |
| 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 isThreadsafe() const { return false; } |
| 88 virtual bool isGPUTest() const { return true; } | |
| 86 private: | 89 private: |
| 87 }; | 90 }; |
| 88 | 91 |
| 89 typedef SkTRegistry<Test*(*)(void*)> TestRegistry; | 92 typedef SkTRegistry<Test*(*)(void*)> TestRegistry; |
| 90 } // namespace skiatest | 93 } // namespace skiatest |
| 91 | 94 |
| 92 /* | 95 /* |
| 93 Use the following macros to make use of the skiatest classes, e.g. | 96 Use the following macros to make use of the skiatest classes, e.g. |
| 94 | 97 |
| 95 #include "Test.h" | 98 #include "Test.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 } \ | 166 } \ |
| 164 virtual void onRun(Reporter* r) SK_OVERRIDE { \ | 167 virtual void onRun(Reporter* r) SK_OVERRIDE { \ |
| 165 name(r, GetGrContextFactory()); \ | 168 name(r, GetGrContextFactory()); \ |
| 166 } \ | 169 } \ |
| 167 }; \ | 170 }; \ |
| 168 static TestRegistry gReg_##name##Class(name##Class::Factory); \ | 171 static TestRegistry gReg_##name##Class(name##Class::Factory); \ |
| 169 } \ | 172 } \ |
| 170 static void name(skiatest::Reporter* reporter, GrContextFactory* factory) | 173 static void name(skiatest::Reporter* reporter, GrContextFactory* factory) |
| 171 | 174 |
| 172 #endif | 175 #endif |
| OLD | NEW |