| 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 | 38aeb0f | 2014-02-26 23:01:57 +0000 | [diff] [blame^] | 11 | static SkString test_name(const char* name) { |
| 12 | SkString result("test "); |
| 13 | result.append(name); |
| 14 | return result; |
| 15 | } |
| 16 | |
| commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 17 | TestTask::TestTask(Reporter* reporter, |
| 18 | TaskRunner* taskRunner, |
| 19 | skiatest::TestRegistry::Factory factory) |
| 20 | : Task(reporter, taskRunner) |
| commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 21 | , fTest(factory(NULL)) |
| commit-bot@chromium.org | 38aeb0f | 2014-02-26 23:01:57 +0000 | [diff] [blame^] | 22 | , fName(test_name(fTest->getName())) {} |
| commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 23 | |
| 24 | void TestTask::draw() { |
| 25 | if (this->usesGpu()) { |
| commit-bot@chromium.org | 38aeb0f | 2014-02-26 23:01:57 +0000 | [diff] [blame^] | 26 | fTest->setGrContextFactory(this->getGrContextFactory()); |
| commit-bot@chromium.org | 0dc5bd1 | 2014-02-26 16:31:22 +0000 | [diff] [blame] | 27 | } |
| 28 | fTest->setReporter(&fTestReporter); |
| 29 | fTest->run(); |
| 30 | if (!fTest->passed()) { |
| 31 | this->fail(fTestReporter.failure()); |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | bool TestTask::TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; } |
| 36 | bool TestTask::TestReporter::allowThreaded() const { return !FLAGS_pathOpsSingleThread; } |
| 37 | bool TestTask::TestReporter::verbose() const { return FLAGS_pathOpsVerbose; } |
| 38 | |
| 39 | } // namespace DM |