OLD | NEW |
(Empty) | |
| 1 #ifndef DMTestTask_DEFINED |
| 2 #define DMTestTask_DEFINED |
| 3 |
| 4 #include "DMReporter.h" |
| 5 #include "DMTask.h" |
| 6 #include "DMTaskRunner.h" |
| 7 #include "SkString.h" |
| 8 #include "SkTemplates.h" |
| 9 #include "Test.h" |
| 10 |
| 11 // Runs a unit test. |
| 12 namespace DM { |
| 13 |
| 14 class TestTask : public Task { |
| 15 public: |
| 16 TestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); |
| 17 |
| 18 virtual void draw() SK_OVERRIDE; |
| 19 virtual bool usesGpu() const SK_OVERRIDE { return fTest->isGPUTest(); } |
| 20 virtual bool shouldSkip() const SK_OVERRIDE { return false; } |
| 21 virtual SkString name() const SK_OVERRIDE { return fName; } |
| 22 |
| 23 private: |
| 24 class TestReporter : public skiatest::Reporter { |
| 25 public: |
| 26 TestReporter() {} |
| 27 |
| 28 const char* failure() const { return fFailure.c_str(); } |
| 29 |
| 30 private: |
| 31 virtual bool allowExtendedTest() const SK_OVERRIDE; |
| 32 virtual bool allowThreaded() const SK_OVERRIDE; |
| 33 virtual bool verbose() const SK_OVERRIDE; |
| 34 |
| 35 virtual void onReportFailed(const SkString& desc) SK_OVERRIDE { |
| 36 fFailure = desc; |
| 37 } |
| 38 |
| 39 SkString fFailure; |
| 40 }; |
| 41 |
| 42 TaskRunner* fTaskRunner; |
| 43 TestReporter fTestReporter; |
| 44 SkAutoTDelete<skiatest::Test> fTest; |
| 45 const SkString fName; |
| 46 }; |
| 47 |
| 48 } // namespace DM |
| 49 |
| 50 #endif // DMTestTask_DEFINED |
OLD | NEW |