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" |
| 4 | |
| 5 | DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); |
| 6 | DEFINE_bool2(pathOpsSingleThread, z, false, "Disallow pathOps tests from using threads."); |
| 7 | DEFINE_bool2(pathOpsVerbose, V, false, "Tell pathOps tests to be verbose."); |
| 8 | |
| 9 | namespace DM { |
| 10 | |
commit-bot@chromium.org | ef57b7e | 2014-02-28 20:31:31 +0000 | [diff] [blame] | 11 | bool TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; } |
| 12 | bool TestReporter::allowThreaded() const { return !FLAGS_pathOpsSingleThread; } |
| 13 | bool TestReporter::verbose() const { return FLAGS_pathOpsVerbose; } |
| 14 | |
commit-bot@chromium.org | 38aeb0f | 2014-02-26 23:01:57 +0000 | [diff] [blame] | 15 | static SkString test_name(const char* name) { |
| 16 | SkString result("test "); |
| 17 | result.append(name); |
| 18 | return result; |
| 19 | } |
| 20 | |
commit-bot@chromium.org | ef57b7e | 2014-02-28 20:31:31 +0000 | [diff] [blame] | 21 | CpuTestTask::CpuTestTask(Reporter* reporter, |
| 22 | TaskRunner* taskRunner, |
| 23 | skiatest::TestRegistry::Factory factory) |
| 24 | : CpuTask(reporter, taskRunner) |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 25 | , fTest(factory(NULL)) |
commit-bot@chromium.org | 38aeb0f | 2014-02-26 23:01:57 +0000 | [diff] [blame] | 26 | , fName(test_name(fTest->getName())) {} |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 27 | |
commit-bot@chromium.org | ef57b7e | 2014-02-28 20:31:31 +0000 | [diff] [blame] | 28 | GpuTestTask::GpuTestTask(Reporter* reporter, |
| 29 | TaskRunner* taskRunner, |
| 30 | skiatest::TestRegistry::Factory factory) |
| 31 | : GpuTask(reporter, taskRunner) |
| 32 | , fTest(factory(NULL)) |
| 33 | , fName(test_name(fTest->getName())) {} |
| 34 | |
| 35 | |
| 36 | void CpuTestTask::draw() { |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 37 | fTest->setReporter(&fTestReporter); |
| 38 | fTest->run(); |
| 39 | if (!fTest->passed()) { |
| 40 | this->fail(fTestReporter.failure()); |
| 41 | } |
| 42 | } |
| 43 | |
commit-bot@chromium.org | ef57b7e | 2014-02-28 20:31:31 +0000 | [diff] [blame] | 44 | void GpuTestTask::draw(GrContextFactory* grFactory) { |
| 45 | fTest->setGrContextFactory(grFactory); |
| 46 | fTest->setReporter(&fTestReporter); |
| 47 | fTest->run(); |
| 48 | if (!fTest->passed()) { |
| 49 | this->fail(fTestReporter.failure()); |
| 50 | } |
| 51 | } |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 52 | |
commit-bot@chromium.org | 787227d | 2014-03-26 21:26:15 +0000 | [diff] [blame] | 53 | bool GpuTestTask::shouldSkip() const { |
| 54 | return kGPUDisabled; |
| 55 | } |
| 56 | |
commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 57 | } // namespace DM |