| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "Test.h" | 8 #include "Test.h" |
| 9 | 9 |
| 10 #include "SkCommandLineFlags.h" | 10 #include "SkCommandLineFlags.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 class LocalReporter : public Reporter { | 61 class LocalReporter : public Reporter { |
| 62 public: | 62 public: |
| 63 explicit LocalReporter(Reporter* reporterToMimic) : fReporter(reporterToMimi
c) {} | 63 explicit LocalReporter(Reporter* reporterToMimic) : fReporter(reporterToMimi
c) {} |
| 64 | 64 |
| 65 int numFailures() const { return fFailures.count(); } | 65 int numFailures() const { return fFailures.count(); } |
| 66 const skiatest::Failure& failure(int i) const { return fFailures[i]; } | 66 const skiatest::Failure& failure(int i) const { return fFailures[i]; } |
| 67 | 67 |
| 68 protected: | 68 protected: |
| 69 virtual void onReportFailed(const Failure& failure) SK_OVERRIDE { | 69 void onReportFailed(const Failure& failure) SK_OVERRIDE { |
| 70 fFailures.push_back(failure); | 70 fFailures.push_back(failure); |
| 71 } | 71 } |
| 72 | 72 |
| 73 // Proxy down to fReporter. We assume these calls are threadsafe. | 73 // Proxy down to fReporter. We assume these calls are threadsafe. |
| 74 virtual bool allowExtendedTest() const SK_OVERRIDE { | 74 bool allowExtendedTest() const SK_OVERRIDE { |
| 75 return fReporter->allowExtendedTest(); | 75 return fReporter->allowExtendedTest(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 virtual void bumpTestCount() SK_OVERRIDE { | 78 void bumpTestCount() SK_OVERRIDE { |
| 79 fReporter->bumpTestCount(); | 79 fReporter->bumpTestCount(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 virtual bool verbose() const SK_OVERRIDE { | 82 bool verbose() const SK_OVERRIDE { |
| 83 return fReporter->verbose(); | 83 return fReporter->verbose(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 Reporter* fReporter; // Unowned. | 87 Reporter* fReporter; // Unowned. |
| 88 SkTArray<skiatest::Failure> fFailures; | 88 SkTArray<skiatest::Failure> fFailures; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 void Test::run() { | 91 void Test::run() { |
| 92 // Clear the Skia error callback before running any test, to ensure that tes
ts | 92 // Clear the Skia error callback before running any test, to ensure that tes
ts |
| (...skipping 16 matching lines...) Expand all Loading... |
| 109 fReporter->reportFailed(local.failure(i)); | 109 fReporter->reportFailed(local.failure(i)); |
| 110 } | 110 } |
| 111 fReporter->endTest(this); | 111 fReporter->endTest(this); |
| 112 | 112 |
| 113 } | 113 } |
| 114 | 114 |
| 115 SkString Test::GetTmpDir() { | 115 SkString Test::GetTmpDir() { |
| 116 const char* tmpDir = FLAGS_tmpDir.isEmpty() ? NULL : FLAGS_tmpDir[0]; | 116 const char* tmpDir = FLAGS_tmpDir.isEmpty() ? NULL : FLAGS_tmpDir[0]; |
| 117 return SkString(tmpDir); | 117 return SkString(tmpDir); |
| 118 } | 118 } |
| OLD | NEW |