aboutsummaryrefslogtreecommitdiffhomepage
path: root/dm/DMTestTask.cpp
blob: 7a5f8cf9f98d606d07d78f290c7f698484910040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "DMTestTask.h"
#include "DMUtil.h"
#include "SkCommandLineFlags.h"

DEFINE_bool2(pathOpsExtended,     x, false, "Run extended pathOps tests.");
DEFINE_bool2(pathOpsSingleThread, z, false, "Disallow pathOps tests from using threads.");
DEFINE_bool2(pathOpsVerbose,      V, false, "Tell pathOps tests to be verbose.");

namespace DM {

TestTask::TestTask(Reporter* reporter,
                   TaskRunner* taskRunner,
                   skiatest::TestRegistry::Factory factory)
    : Task(reporter, taskRunner)
    , fTaskRunner(taskRunner)
    , fTest(factory(NULL))
    , fName(UnderJoin("test", fTest->getName())) {}

void TestTask::draw() {
    if (this->usesGpu()) {
        fTest->setGrContextFactory(fTaskRunner->getGrContextFactory());
    }
    fTest->setReporter(&fTestReporter);
    fTest->run();
    if (!fTest->passed()) {
        this->fail(fTestReporter.failure());
    }
}

bool TestTask::TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; }
bool TestTask::TestReporter::allowThreaded()     const { return !FLAGS_pathOpsSingleThread; }
bool TestTask::TestReporter::verbose()           const { return FLAGS_pathOpsVerbose; }

}  // namespace DM