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 "DMTask.h" | 6 #include "DMTask.h" |
6 #include "DMTaskRunner.h" | 7 #include "DMTaskRunner.h" |
7 #include "SkString.h" | 8 #include "SkString.h" |
8 #include "SkTemplates.h" | 9 #include "SkTemplates.h" |
9 #include "Test.h" | 10 #include "Test.h" |
10 | 11 |
11 // Runs a unit test. | 12 // Runs a unit test. |
12 namespace DM { | 13 namespace DM { |
13 | 14 |
14 class TestReporter : public skiatest::Reporter { | 15 class TestReporter : public skiatest::Reporter { |
15 public: | 16 public: |
16 TestReporter() {} | 17 TestReporter() {} |
17 | 18 |
18 const char* failure() const { return fFailure.c_str(); } | 19 const char* failure() const { return fFailure.c_str(); } |
19 | 20 |
20 private: | 21 private: |
21 virtual bool allowExtendedTest() const SK_OVERRIDE; | 22 virtual bool allowExtendedTest() const SK_OVERRIDE; |
22 virtual bool verbose() const SK_OVERRIDE; | 23 virtual bool verbose() const SK_OVERRIDE; |
23 | 24 |
24 virtual void onReportFailed(const SkString& desc) SK_OVERRIDE { | 25 virtual void onReportFailed(const skiatest::Failure& failure) SK_OVERRIDE { |
25 fFailure = desc; | 26 JsonWriter::AddTestFailure(failure); |
27 | |
28 SkString newFailure; | |
29 skiatest::Failure::GetFailureString(&newFailure, failure); | |
30 if (!fFailure.isEmpty()) { | |
31 fFailure.append("\n\t\t"); | |
32 } | |
33 fFailure.append(newFailure); | |
scroggo
2014/11/05 20:40:17
This change in behavior is orthogonal to the rest
mtklein
2014/11/06 15:24:05
Nope. This seems like a good change to me. Might
scroggo
2014/11/06 16:52:32
Yeah, I considered doing that, but I wasn't sure t
| |
26 } | 34 } |
27 | 35 |
28 SkString fFailure; | 36 SkString fFailure; |
29 }; | 37 }; |
30 | 38 |
31 class CpuTestTask : public CpuTask { | 39 class CpuTestTask : public CpuTask { |
32 public: | 40 public: |
33 CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); | 41 CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); |
34 | 42 |
35 virtual void draw() SK_OVERRIDE; | 43 virtual void draw() SK_OVERRIDE; |
(...skipping 16 matching lines...) Expand all Loading... | |
52 | 60 |
53 private: | 61 private: |
54 TestReporter fTestReporter; | 62 TestReporter fTestReporter; |
55 SkAutoTDelete<skiatest::Test> fTest; | 63 SkAutoTDelete<skiatest::Test> fTest; |
56 const SkString fName; | 64 const SkString fName; |
57 }; | 65 }; |
58 | 66 |
59 } // namespace DM | 67 } // namespace DM |
60 | 68 |
61 #endif // DMTestTask_DEFINED | 69 #endif // DMTestTask_DEFINED |
OLD | NEW |