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

Unified Diff: dm/DMTestTask.cpp

Issue 853883004: Revert of Sketch DM refactor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DMTestTask.h ('k') | dm/DMUtil.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMTestTask.cpp
diff --git a/dm/DMTestTask.cpp b/dm/DMTestTask.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..366087c351be1a7025f86cea69cbb34495f13a82
--- /dev/null
+++ b/dm/DMTestTask.cpp
@@ -0,0 +1,61 @@
+#include "DMTestTask.h"
+#include "DMUtil.h"
+#include "SkCommandLineFlags.h"
+#include "SkCommonFlags.h"
+
+DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests.");
+
+namespace DM {
+
+bool TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; }
+bool TestReporter::verbose() const { return FLAGS_veryVerbose; }
+
+static SkString test_name(const char* name) {
+ SkString result("test ");
+ result.append(name);
+ return result;
+}
+
+CpuTestTask::CpuTestTask(Reporter* reporter,
+ TaskRunner* taskRunner,
+ skiatest::TestRegistry::Factory factory)
+ : CpuTask(reporter, taskRunner)
+ , fTest(factory(NULL))
+ , fName(test_name(fTest->getName())) {}
+
+GpuTestTask::GpuTestTask(Reporter* reporter,
+ TaskRunner* taskRunner,
+ skiatest::TestRegistry::Factory factory)
+ : GpuTask(reporter, taskRunner)
+ , fTest(factory(NULL))
+ , fName(test_name(fTest->getName())) {}
+
+
+void CpuTestTask::draw() {
+ fTest->setReporter(&fTestReporter);
+ fTest->run();
+ if (!fTest->passed()) {
+ const SkTArray<SkString>& failures = fTestReporter.failures();
+ for (int i = 0; i < failures.count(); i++) {
+ this->fail(failures[i].c_str());
+ }
+ }
+}
+
+void GpuTestTask::draw(GrContextFactory* grFactory) {
+ fTest->setGrContextFactory(grFactory);
+ fTest->setReporter(&fTestReporter);
+ fTest->run();
+ if (!fTest->passed()) {
+ const SkTArray<SkString>& failures = fTestReporter.failures();
+ for (int i = 0; i < failures.count(); i++) {
+ this->fail(failures[i].c_str());
+ }
+ }
+}
+
+bool GpuTestTask::shouldSkip() const {
+ return kGPUDisabled;
+}
+
+} // namespace DM
« no previous file with comments | « dm/DMTestTask.h ('k') | dm/DMUtil.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698