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