commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 1 | #include "DMTestTask.h" |
| 2 | #include "DMUtil.h" |
| 3 | #include "SkCommandLineFlags.h" |
halcanary | 59598b0 | 2014-08-13 10:30:57 -0700 | [diff] [blame] | 4 | #include "SkCommonFlags.h" |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 5 | |
mtklein | 406654b | 2014-09-03 15:34:37 -0700 | [diff] [blame] | 6 | DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 7 | |
| 8 | namespace DM { |
| 9 | |
commit-bot@chromium.org | ef57b7e | 2014-02-28 20:31:31 +0000 | [diff] [blame] | 10 | bool TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; } |
halcanary | 59598b0 | 2014-08-13 10:30:57 -0700 | [diff] [blame] | 11 | bool TestReporter::verbose() const { return FLAGS_veryVerbose; } |
commit-bot@chromium.org | ef57b7e | 2014-02-28 20:31:31 +0000 | [diff] [blame] | 12 | |
commit-bot@chromium.org | 38aeb0f | 2014-02-26 23:01:57 +0000 | [diff] [blame] | 13 | static SkString test_name(const char* name) { |
| 14 | SkString result("test "); |
| 15 | result.append(name); |
| 16 | return result; |
| 17 | } |
| 18 | |
commit-bot@chromium.org | ef57b7e | 2014-02-28 20:31:31 +0000 | [diff] [blame] | 19 | CpuTestTask::CpuTestTask(Reporter* reporter, |
| 20 | TaskRunner* taskRunner, |
| 21 | skiatest::TestRegistry::Factory factory) |
| 22 | : CpuTask(reporter, taskRunner) |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 23 | , fTest(factory(NULL)) |
commit-bot@chromium.org | 38aeb0f | 2014-02-26 23:01:57 +0000 | [diff] [blame] | 24 | , fName(test_name(fTest->getName())) {} |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 25 | |
commit-bot@chromium.org | ef57b7e | 2014-02-28 20:31:31 +0000 | [diff] [blame] | 26 | GpuTestTask::GpuTestTask(Reporter* reporter, |
| 27 | TaskRunner* taskRunner, |
| 28 | skiatest::TestRegistry::Factory factory) |
| 29 | : GpuTask(reporter, taskRunner) |
| 30 | , fTest(factory(NULL)) |
| 31 | , fName(test_name(fTest->getName())) {} |
| 32 | |
| 33 | |
| 34 | void CpuTestTask::draw() { |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 35 | fTest->setReporter(&fTestReporter); |
| 36 | fTest->run(); |
| 37 | if (!fTest->passed()) { |
| 38 | this->fail(fTestReporter.failure()); |
| 39 | } |
| 40 | } |
| 41 | |
commit-bot@chromium.org | ef57b7e | 2014-02-28 20:31:31 +0000 | [diff] [blame] | 42 | void GpuTestTask::draw(GrContextFactory* grFactory) { |
| 43 | fTest->setGrContextFactory(grFactory); |
| 44 | fTest->setReporter(&fTestReporter); |
| 45 | fTest->run(); |
| 46 | if (!fTest->passed()) { |
| 47 | this->fail(fTestReporter.failure()); |
| 48 | } |
| 49 | } |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 50 | |
commit-bot@chromium.org | 787227d | 2014-03-26 21:26:15 +0000 | [diff] [blame] | 51 | bool GpuTestTask::shouldSkip() const { |
| 52 | return kGPUDisabled; |
| 53 | } |
| 54 | |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 55 | } // namespace DM |