| OLD | NEW |
| 1 #ifndef DMTestTask_DEFINED | 1 #ifndef DMTestTask_DEFINED |
| 2 #define DMTestTask_DEFINED | 2 #define DMTestTask_DEFINED |
| 3 | 3 |
| 4 #include "DMReporter.h" | 4 #include "DMReporter.h" |
| 5 #include "DMJsonWriter.h" | 5 #include "DMJsonWriter.h" |
| 6 #include "DMTask.h" | 6 #include "DMTask.h" |
| 7 #include "DMTaskRunner.h" | 7 #include "DMTaskRunner.h" |
| 8 #include "SkString.h" | 8 #include "SkString.h" |
| 9 #include "SkTemplates.h" | 9 #include "SkTemplates.h" |
| 10 #include "Test.h" | 10 #include "Test.h" |
| 11 | 11 |
| 12 // Runs a unit test. | 12 // Runs a unit test. |
| 13 namespace DM { | 13 namespace DM { |
| 14 | 14 |
| 15 class TestReporter : public skiatest::Reporter { | 15 class TestReporter : public skiatest::Reporter { |
| 16 public: | 16 public: |
| 17 TestReporter() {} | 17 TestReporter() {} |
| 18 | 18 |
| 19 const SkTArray<SkString>& failures() const { return fFailures; } | 19 const SkTArray<SkString>& failures() const { return fFailures; } |
| 20 | 20 |
| 21 private: | 21 private: |
| 22 virtual bool allowExtendedTest() const SK_OVERRIDE; | 22 bool allowExtendedTest() const SK_OVERRIDE; |
| 23 virtual bool verbose() const SK_OVERRIDE; | 23 bool verbose() const SK_OVERRIDE; |
| 24 | 24 |
| 25 virtual void onReportFailed(const skiatest::Failure& failure) SK_OVERRIDE { | 25 void onReportFailed(const skiatest::Failure& failure) SK_OVERRIDE { |
| 26 JsonWriter::AddTestFailure(failure); | 26 JsonWriter::AddTestFailure(failure); |
| 27 | 27 |
| 28 SkString newFailure; | 28 SkString newFailure; |
| 29 failure.getFailureString(&newFailure); | 29 failure.getFailureString(&newFailure); |
| 30 fFailures.push_back(newFailure); | 30 fFailures.push_back(newFailure); |
| 31 } | 31 } |
| 32 | 32 |
| 33 SkTArray<SkString> fFailures; | 33 SkTArray<SkString> fFailures; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 class CpuTestTask : public CpuTask { | 36 class CpuTestTask : public CpuTask { |
| 37 public: | 37 public: |
| 38 CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); | 38 CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); |
| 39 | 39 |
| 40 virtual void draw() SK_OVERRIDE; | 40 void draw() SK_OVERRIDE; |
| 41 virtual bool shouldSkip() const SK_OVERRIDE { return false; } | 41 bool shouldSkip() const SK_OVERRIDE { return false; } |
| 42 virtual SkString name() const SK_OVERRIDE { return fName; } | 42 SkString name() const SK_OVERRIDE { return fName; } |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 TestReporter fTestReporter; | 45 TestReporter fTestReporter; |
| 46 SkAutoTDelete<skiatest::Test> fTest; | 46 SkAutoTDelete<skiatest::Test> fTest; |
| 47 const SkString fName; | 47 const SkString fName; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 class GpuTestTask : public GpuTask { | 50 class GpuTestTask : public GpuTask { |
| 51 public: | 51 public: |
| 52 GpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); | 52 GpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); |
| 53 | 53 |
| 54 virtual void draw(GrContextFactory*) SK_OVERRIDE; | 54 void draw(GrContextFactory*) SK_OVERRIDE; |
| 55 virtual bool shouldSkip() const SK_OVERRIDE; | 55 bool shouldSkip() const SK_OVERRIDE; |
| 56 virtual SkString name() const SK_OVERRIDE { return fName; } | 56 SkString name() const SK_OVERRIDE { return fName; } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 TestReporter fTestReporter; | 59 TestReporter fTestReporter; |
| 60 SkAutoTDelete<skiatest::Test> fTest; | 60 SkAutoTDelete<skiatest::Test> fTest; |
| 61 const SkString fName; | 61 const SkString fName; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace DM | 64 } // namespace DM |
| 65 | 65 |
| 66 #endif // DMTestTask_DEFINED | 66 #endif // DMTestTask_DEFINED |
| OLD | NEW |