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

Side by Side Diff: dm/DMTestTask.h

Issue 741833002: Store DM failures in an array, not a single string. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « no previous file | dm/DMTestTask.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 "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 char* failure() const { return fFailure.c_str(); } 19 const SkTArray<SkString>& failures() const { return fFailures; }
20 20
21 private: 21 private:
22 virtual bool allowExtendedTest() const SK_OVERRIDE; 22 virtual bool allowExtendedTest() const SK_OVERRIDE;
23 virtual bool verbose() const SK_OVERRIDE; 23 virtual bool verbose() const SK_OVERRIDE;
24 24
25 virtual void onReportFailed(const skiatest::Failure& failure) SK_OVERRIDE { 25 virtual 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 // TODO: Better to store an array of failures? 30 fFailures.push_back(newFailure);
31 if (!fFailure.isEmpty()) {
32 fFailure.append("\n\t\t");
33 }
34 fFailure.append(newFailure);
35 } 31 }
36 32
37 SkString fFailure; 33 SkTArray<SkString> fFailures;
38 }; 34 };
39 35
40 class CpuTestTask : public CpuTask { 36 class CpuTestTask : public CpuTask {
41 public: 37 public:
42 CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); 38 CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory);
43 39
44 virtual void draw() SK_OVERRIDE; 40 virtual void draw() SK_OVERRIDE;
45 virtual bool shouldSkip() const SK_OVERRIDE { return false; } 41 virtual bool shouldSkip() const SK_OVERRIDE { return false; }
46 virtual SkString name() const SK_OVERRIDE { return fName; } 42 virtual SkString name() const SK_OVERRIDE { return fName; }
47 43
(...skipping 13 matching lines...) Expand all
61 57
62 private: 58 private:
63 TestReporter fTestReporter; 59 TestReporter fTestReporter;
64 SkAutoTDelete<skiatest::Test> fTest; 60 SkAutoTDelete<skiatest::Test> fTest;
65 const SkString fName; 61 const SkString fName;
66 }; 62 };
67 63
68 } // namespace DM 64 } // namespace DM
69 65
70 #endif // DMTestTask_DEFINED 66 #endif // DMTestTask_DEFINED
OLDNEW
« no previous file with comments | « no previous file | dm/DMTestTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698