aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DMTestTask.h
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-26 16:31:22 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-02-26 16:31:22 +0000
commit0dc5bd149a8b69e8dc6d3b4713b827659c9b0a6b (patch)
tree53fdc1e7747c8ed33c275deb6f24802bc41d365a /dm/DMTestTask.h
parent1e762d39bb6383d33d8e1f04a296f164aa2a6beb (diff)
Let DM run unit tests.
- refactor GYPs and a few flags - make GPU tests grab a thread-local GrContextFactory when needed as we do in DM for GMs - add a few more UI features to make DM more like tests I believe this makes the program 'tests' obsolete. It should be somewhat faster to run the two sets together than running the old binaries serially: - serial: tests 20s (3m18s CPU), dm 21s (3m01s CPU) - together: 27s (6m21s CPU) Next up is to incorporate benches. I'm only planning there on a single-pass sanity check, so that won't obsolete the program 'bench' just yet. Tested: out/Debug/tests && out/Debug/dm && echo ok BUG=skia: Committed: http://code.google.com/p/skia/source/detail?r=13586 R=reed@google.com, bsalomon@google.com, mtklein@google.com, tfarina@chromium.org Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/178273002 git-svn-id: http://skia.googlecode.com/svn/trunk@13592 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'dm/DMTestTask.h')
-rw-r--r--dm/DMTestTask.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/dm/DMTestTask.h b/dm/DMTestTask.h
new file mode 100644
index 0000000000..a4903ee717
--- /dev/null
+++ b/dm/DMTestTask.h
@@ -0,0 +1,50 @@
+#ifndef DMTestTask_DEFINED
+#define DMTestTask_DEFINED
+
+#include "DMReporter.h"
+#include "DMTask.h"
+#include "DMTaskRunner.h"
+#include "SkString.h"
+#include "SkTemplates.h"
+#include "Test.h"
+
+// Runs a unit test.
+namespace DM {
+
+class TestTask : public Task {
+public:
+ TestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory);
+
+ virtual void draw() SK_OVERRIDE;
+ virtual bool usesGpu() const SK_OVERRIDE { return fTest->isGPUTest(); }
+ virtual bool shouldSkip() const SK_OVERRIDE { return false; }
+ virtual SkString name() const SK_OVERRIDE { return fName; }
+
+private:
+ class TestReporter : public skiatest::Reporter {
+ public:
+ TestReporter() {}
+
+ const char* failure() const { return fFailure.c_str(); }
+
+ private:
+ virtual bool allowExtendedTest() const SK_OVERRIDE;
+ virtual bool allowThreaded() const SK_OVERRIDE;
+ virtual bool verbose() const SK_OVERRIDE;
+
+ virtual void onReportFailed(const SkString& desc) SK_OVERRIDE {
+ fFailure = desc;
+ }
+
+ SkString fFailure;
+ };
+
+ TaskRunner* fTaskRunner;
+ TestReporter fTestReporter;
+ SkAutoTDelete<skiatest::Test> fTest;
+ const SkString fName;
+};
+
+} // namespace DM
+
+#endif // DMTestTask_DEFINED