| 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 | |
| 11 | TestTask::TestTask(Reporter* reporter, |
| 12 | TaskRunner* taskRunner, |
| 13 | skiatest::TestRegistry::Factory factory) |
| 14 | : Task(reporter, taskRunner) |
| 15 | , fTaskRunner(taskRunner) |
| 16 | , fTest(factory(NULL)) |
| 17 | , fName(UnderJoin("test", fTest->getName())) {} |
| 18 | |
| 19 | void TestTask::draw() { |
| 20 | if (this->usesGpu()) { |
| 21 | fTest->setGrContextFactory(fTaskRunner->getGrContextFactory()); |
| 22 | } |
| 23 | fTest->setReporter(&fTestReporter); |
| 24 | fTest->run(); |
| 25 | if (!fTest->passed()) { |
| 26 | this->fail(fTestReporter.failure()); |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | bool TestTask::TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; } |
| 31 | bool TestTask::TestReporter::allowThreaded() const { return !FLAGS_pathOpsSingleThread; } |
| 32 | bool TestTask::TestReporter::verbose() const { return FLAGS_pathOpsVerbose; } |
| 33 | |
| 34 | } // namespace DM |