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 "CrashHandler.h" | 8 #include "CrashHandler.h" |
9 #include "OverwriteLine.h" | 9 #include "OverwriteLine.h" |
10 #include "Resources.h" | 10 #include "Resources.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 int32_t fTestCount; // atomic | 69 int32_t fTestCount; // atomic |
70 int32_t fFailCount; // atomic | 70 int32_t fFailCount; // atomic |
71 const int fTotal; | 71 const int fTotal; |
72 }; | 72 }; |
73 | 73 |
74 // Deletes self when run. | 74 // Deletes self when run. |
75 class SkTestRunnable : public SkRunnable { | 75 class SkTestRunnable : public SkRunnable { |
76 public: | 76 public: |
77 SkTestRunnable(const Test& test, | 77 SkTestRunnable(const Test& test, |
78 Status* status, | 78 Status* status, |
79 GrContextFactory* grContextFactory = NULL) | 79 GrContextFactory* grContextFactory = nullptr) |
80 : fTest(test), fStatus(status), fGrContextFactory(grContextFactory) {} | 80 : fTest(test), fStatus(status), fGrContextFactory(grContextFactory) {} |
81 | 81 |
82 virtual void run() { | 82 virtual void run() { |
83 struct TestReporter : public skiatest::Reporter { | 83 struct TestReporter : public skiatest::Reporter { |
84 public: | 84 public: |
85 TestReporter() : fError(false), fTestCount(0) {} | 85 TestReporter() : fError(false), fTestCount(0) {} |
86 void bumpTestCount() override { ++fTestCount; } | 86 void bumpTestCount() override { ++fTestCount; } |
87 bool allowExtendedTest() const override { | 87 bool allowExtendedTest() const override { |
88 return FLAGS_extendedTest; | 88 return FLAGS_extendedTest; |
89 } | 89 } |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const Test& test = iter->factory(); | 186 const Test& test = iter->factory(); |
187 if (!should_run(test.name, test.needsGpu)) { | 187 if (!should_run(test.name, test.needsGpu)) { |
188 ++skipCount; | 188 ++skipCount; |
189 } else if (test.needsGpu) { | 189 } else if (test.needsGpu) { |
190 gpuTests.push_back(&test); | 190 gpuTests.push_back(&test); |
191 } else { | 191 } else { |
192 cpuTests.add(new SkTestRunnable(test, &status)); | 192 cpuTests.add(new SkTestRunnable(test, &status)); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
196 GrContextFactory* grContextFactoryPtr = NULL; | 196 GrContextFactory* grContextFactoryPtr = nullptr; |
197 #if SK_SUPPORT_GPU | 197 #if SK_SUPPORT_GPU |
198 // Give GPU tests a context factory if that makes sense on this machine. | 198 // Give GPU tests a context factory if that makes sense on this machine. |
199 GrContextFactory grContextFactory; | 199 GrContextFactory grContextFactory; |
200 grContextFactoryPtr = &grContextFactory; | 200 grContextFactoryPtr = &grContextFactory; |
201 | 201 |
202 #endif | 202 #endif |
203 | 203 |
204 // Run GPU tests on this thread. | 204 // Run GPU tests on this thread. |
205 for (int i = 0; i < gpuTests.count(); i++) { | 205 for (int i = 0; i < gpuTests.count(); i++) { |
206 (new SkTestRunnable(*gpuTests[i], &status, grContextFactoryPtr))->run(); | 206 (new SkTestRunnable(*gpuTests[i], &status, grContextFactoryPtr))->run(); |
(...skipping 12 matching lines...) Expand all Loading... |
219 SkDebugf("\n"); | 219 SkDebugf("\n"); |
220 return (status.failCount() == 0) ? 0 : 1; | 220 return (status.failCount() == 0) ? 0 : 1; |
221 } | 221 } |
222 | 222 |
223 #if !defined(SK_BUILD_FOR_IOS) | 223 #if !defined(SK_BUILD_FOR_IOS) |
224 int main(int argc, char** argv) { | 224 int main(int argc, char** argv) { |
225 SkCommandLineFlags::Parse(argc, argv); | 225 SkCommandLineFlags::Parse(argc, argv); |
226 return test_main(); | 226 return test_main(); |
227 } | 227 } |
228 #endif | 228 #endif |
OLD | NEW |