Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(401)

Side by Side Diff: dm/DMTestTask.h

Issue 694703005: When running DM, write test failures to json. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use "" instead of NULL Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « dm/DMJsonWriter.cpp ('k') | tests/GrTRecorderTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 failure.getFailureString(&newFailure);
30 // TODO: Better to store an array of failures?
31 if (!fFailure.isEmpty()) {
32 fFailure.append("\n\t\t");
33 }
34 fFailure.append(newFailure);
26 } 35 }
27 36
28 SkString fFailure; 37 SkString fFailure;
29 }; 38 };
30 39
31 class CpuTestTask : public CpuTask { 40 class CpuTestTask : public CpuTask {
32 public: 41 public:
33 CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); 42 CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory);
34 43
35 virtual void draw() SK_OVERRIDE; 44 virtual void draw() SK_OVERRIDE;
(...skipping 16 matching lines...) Expand all
52 61
53 private: 62 private:
54 TestReporter fTestReporter; 63 TestReporter fTestReporter;
55 SkAutoTDelete<skiatest::Test> fTest; 64 SkAutoTDelete<skiatest::Test> fTest;
56 const SkString fName; 65 const SkString fName;
57 }; 66 };
58 67
59 } // namespace DM 68 } // namespace DM
60 69
61 #endif // DMTestTask_DEFINED 70 #endif // DMTestTask_DEFINED
OLDNEW
« no previous file with comments | « dm/DMJsonWriter.cpp ('k') | tests/GrTRecorderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698