2014-02-26 16:31:22 +00:00
|
|
|
#ifndef DMTestTask_DEFINED
|
|
|
|
#define DMTestTask_DEFINED
|
|
|
|
|
|
|
|
#include "DMReporter.h"
|
|
|
|
#include "DMTask.h"
|
|
|
|
#include "DMTaskRunner.h"
|
|
|
|
#include "SkString.h"
|
|
|
|
#include "SkTemplates.h"
|
|
|
|
#include "Test.h"
|
|
|
|
|
|
|
|
// Runs a unit test.
|
|
|
|
namespace DM {
|
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
class TestReporter : public skiatest::Reporter {
|
2014-02-26 16:31:22 +00:00
|
|
|
public:
|
2014-02-28 20:31:31 +00:00
|
|
|
TestReporter() {}
|
|
|
|
|
|
|
|
const char* failure() const { return fFailure.c_str(); }
|
|
|
|
|
|
|
|
private:
|
|
|
|
virtual bool allowExtendedTest() const SK_OVERRIDE;
|
|
|
|
virtual bool verbose() const SK_OVERRIDE;
|
|
|
|
|
|
|
|
virtual void onReportFailed(const SkString& desc) SK_OVERRIDE {
|
|
|
|
fFailure = desc;
|
|
|
|
}
|
|
|
|
|
|
|
|
SkString fFailure;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CpuTestTask : public CpuTask {
|
|
|
|
public:
|
|
|
|
CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory);
|
2014-02-26 16:31:22 +00:00
|
|
|
|
|
|
|
virtual void draw() SK_OVERRIDE;
|
|
|
|
virtual bool shouldSkip() const SK_OVERRIDE { return false; }
|
|
|
|
virtual SkString name() const SK_OVERRIDE { return fName; }
|
|
|
|
|
|
|
|
private:
|
2014-02-28 20:31:31 +00:00
|
|
|
TestReporter fTestReporter;
|
|
|
|
SkAutoTDelete<skiatest::Test> fTest;
|
|
|
|
const SkString fName;
|
|
|
|
};
|
2014-02-26 16:31:22 +00:00
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
class GpuTestTask : public GpuTask {
|
|
|
|
public:
|
|
|
|
GpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory);
|
2014-02-26 16:31:22 +00:00
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
virtual void draw(GrContextFactory*) SK_OVERRIDE;
|
2014-03-26 21:26:15 +00:00
|
|
|
virtual bool shouldSkip() const SK_OVERRIDE;
|
2014-02-28 20:31:31 +00:00
|
|
|
virtual SkString name() const SK_OVERRIDE { return fName; }
|
2014-02-26 16:31:22 +00:00
|
|
|
|
2014-02-28 20:31:31 +00:00
|
|
|
private:
|
2014-02-26 16:31:22 +00:00
|
|
|
TestReporter fTestReporter;
|
|
|
|
SkAutoTDelete<skiatest::Test> fTest;
|
|
|
|
const SkString fName;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace DM
|
|
|
|
|
|
|
|
#endif // DMTestTask_DEFINED
|