Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: tests/skia_test.cpp

Issue 17414003: Refactor: clean up some unused or mostly-unused API I saw here. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: bungeman Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/Test.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "SkCommandLineFlags.h" 8 #include "SkCommandLineFlags.h"
9 #include "SkGraphics.h" 9 #include "SkGraphics.h"
10 #include "SkOSFile.h" 10 #include "SkOSFile.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 return test; 48 return test;
49 } 49 }
50 return NULL; 50 return NULL;
51 } 51 }
52 52
53 private: 53 private:
54 Reporter* fReporter; 54 Reporter* fReporter;
55 const TestRegistry* fReg; 55 const TestRegistry* fReg;
56 }; 56 };
57 57
58 static const char* result2string(Reporter::Result result) {
59 return result == Reporter::kPassed ? "passed" : "FAILED";
60 }
61
62 class DebugfReporter : public Reporter { 58 class DebugfReporter : public Reporter {
63 public: 59 public:
64 DebugfReporter(bool allowExtendedTest, bool allowThreaded) 60 DebugfReporter(bool allowExtendedTest, bool allowThreaded)
65 : fNextIndex(0) 61 : fNextIndex(0)
66 , fPending(0) 62 , fPending(0)
67 , fTotal(0) 63 , fTotal(0)
68 , fAllowExtendedTest(allowExtendedTest) 64 , fAllowExtendedTest(allowExtendedTest)
69 , fAllowThreaded(allowThreaded) { 65 , fAllowThreaded(allowThreaded) {
70 } 66 }
71 67
72 void setTotal(int total) { 68 void setTotal(int total) {
73 fTotal = total; 69 fTotal = total;
74 } 70 }
75 71
76 virtual bool allowExtendedTest() const SK_OVERRIDE { 72 virtual bool allowExtendedTest() const SK_OVERRIDE {
77 return fAllowExtendedTest; 73 return fAllowExtendedTest;
78 } 74 }
79 75
80 virtual bool allowThreaded() const SK_OVERRIDE { 76 virtual bool allowThreaded() const SK_OVERRIDE {
81 return fAllowThreaded; 77 return fAllowThreaded;
82 } 78 }
83 79
84 protected: 80 protected:
85 virtual void onStart(Test* test) { 81 virtual void onStart(Test* test) {
86 const int index = sk_atomic_inc(&fNextIndex); 82 const int index = sk_atomic_inc(&fNextIndex);
87 sk_atomic_inc(&fPending); 83 sk_atomic_inc(&fPending);
88 SkDebugf("[%3d/%3d] (%d) %s\n", index+1, fTotal, fPending, test->getName ()); 84 SkDebugf("[%3d/%3d] (%d) %s\n", index+1, fTotal, fPending, test->getName ());
89 } 85 }
90 virtual void onReport(const char desc[], Reporter::Result result) { 86 virtual void onReportFailed(const SkString& desc) {
91 SkDebugf("\t%s: %s\n", result2string(result), desc); 87 SkDebugf("\tFAILED: %s\n", desc.c_str());
92 } 88 }
93 89
94 virtual void onEnd(Test* test) { 90 virtual void onEnd(Test* test) {
95 if (!test->passed()) { 91 if (!test->passed()) {
96 SkDebugf("---- %s FAILED\n", test->getName()); 92 SkDebugf("---- %s FAILED\n", test->getName());
97 } 93 }
98 94
99 sk_atomic_dec(&fPending); 95 sk_atomic_dec(&fPending);
100 if (fNextIndex == fTotal) { 96 if (fNextIndex == fTotal) {
101 // Just waiting on straggler tests. Shame them by printing their na me and runtime. 97 // Just waiting on straggler tests. Shame them by printing their na me and runtime.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 GpuTest::DestroyContexts(); 293 GpuTest::DestroyContexts();
298 294
299 return (failCount == 0) ? 0 : 1; 295 return (failCount == 0) ? 0 : 1;
300 } 296 }
301 297
302 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 298 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
303 int main(int argc, char * const argv[]) { 299 int main(int argc, char * const argv[]) {
304 return tool_main(argc, (char**) argv); 300 return tool_main(argc, (char**) argv);
305 } 301 }
306 #endif 302 #endif
OLDNEW
« no previous file with comments | « tests/Test.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698