namespace {
class LocalReporter : public Reporter {
public:
- explicit LocalReporter(const Reporter& reporterToMimic) : fReporter(reporterToMimic) {}
+ explicit LocalReporter(Reporter* reporterToMimic) : fReporter(reporterToMimic) {}
int failure_size() const { return fFailures.count(); }
const char* failure(int i) const { return fFailures[i].c_str(); }
}
}
+ // Proxy down to fReporter. We assume these calls are threadsafe.
virtual bool allowExtendedTest() const SK_OVERRIDE {
- return fReporter.allowExtendedTest();
+ return fReporter->allowExtendedTest();
}
virtual bool allowThreaded() const SK_OVERRIDE {
- return fReporter.allowThreaded();
+ return fReporter->allowThreaded();
+ }
+
+ virtual void bumpTestCount() SK_OVERRIDE {
+ fReporter->bumpTestCount();
}
private:
- const Reporter& fReporter;
+ Reporter* fReporter; // Unowned.
SkTArray<SkString> fFailures;
};
} // namespace
const SkMSec start = SkTime::GetMSecs();
// Run the test into a LocalReporter so we know if it's passed or failed without interference
// from other tests that might share fReporter.
- LocalReporter local(*fReporter);
+ LocalReporter local(fReporter);
this->onRun(&local);
fPassed = local.failure_size() == 0;
fElapsed = SkTime::GetMSecs() - start;
kLastResult = kFailed
};
- void bumpTestCount() { sk_atomic_inc(&fTestCount); }
int countTests() const { return fTestCount; }
void startTest(Test*);
void report(const char testDesc[], Result);
void endTest(Test*);
+
virtual bool allowExtendedTest() const { return false; }
virtual bool allowThreaded() const { return false; }
+ virtual void bumpTestCount() { sk_atomic_inc(&fTestCount); }
+
// helpers for tests
void reportFailed(const char desc[]) {
this->report(desc, kFailed);