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

Side by Side Diff: tests/Test.cpp

Issue 132403008: Remove unnamed namespace usage from tests/ (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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
« tests/PixelRefTest.cpp ('K') | « tests/PixelRefTest.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "Test.h" 8 #include "Test.h"
9 9
10 #include "SkString.h" 10 #include "SkString.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 SkRefCnt_SafeAssign(fReporter, r); 49 SkRefCnt_SafeAssign(fReporter, r);
50 } 50 }
51 51
52 const char* Test::getName() { 52 const char* Test::getName() {
53 if (fName.size() == 0) { 53 if (fName.size() == 0) {
54 this->onGetName(&fName); 54 this->onGetName(&fName);
55 } 55 }
56 return fName.c_str(); 56 return fName.c_str();
57 } 57 }
58 58
59 namespace { 59 class LocalReporter : public Reporter {
60 class LocalReporter : public Reporter { 60 public:
61 public: 61 explicit LocalReporter(Reporter* reporterToMimic) : fReporter(reporterToMimi c) {}
62 explicit LocalReporter(Reporter* reporterToMimic) : fReporter(reporterTo Mimic) {}
63 62
64 int failure_size() const { return fFailures.count(); } 63 int failure_size() const { return fFailures.count(); }
robertphillips 2014/01/14 13:19:37 failureSize? numFailures would probably be better
65 const SkString& failure(int i) const { return fFailures[i]; } 64 const SkString& failure(int i) const { return fFailures[i]; }
66 65
67 protected: 66 protected:
robertphillips 2014/01/14 13:19:37 virtual?
68 void onReportFailed(const SkString& desc) SK_OVERRIDE { 67 void onReportFailed(const SkString& desc) SK_OVERRIDE {
69 fFailures.push_back(desc); 68 fFailures.push_back(desc);
70 } 69 }
71 70
72 // Proxy down to fReporter. We assume these calls are threadsafe. 71 // Proxy down to fReporter. We assume these calls are threadsafe.
73 virtual bool allowExtendedTest() const SK_OVERRIDE { 72 virtual bool allowExtendedTest() const SK_OVERRIDE {
74 return fReporter->allowExtendedTest(); 73 return fReporter->allowExtendedTest();
75 } 74 }
76 75
77 virtual bool allowThreaded() const SK_OVERRIDE { 76 virtual bool allowThreaded() const SK_OVERRIDE {
78 return fReporter->allowThreaded(); 77 return fReporter->allowThreaded();
79 } 78 }
80 79
81 virtual void bumpTestCount() SK_OVERRIDE { 80 virtual void bumpTestCount() SK_OVERRIDE {
82 fReporter->bumpTestCount(); 81 fReporter->bumpTestCount();
83 } 82 }
84 83
85 virtual bool verbose() const SK_OVERRIDE { 84 virtual bool verbose() const SK_OVERRIDE {
86 return fReporter->verbose(); 85 return fReporter->verbose();
87 } 86 }
88 87
89 private: 88 private:
90 Reporter* fReporter; // Unowned. 89 Reporter* fReporter; // Unowned.
91 SkTArray<SkString> fFailures; 90 SkTArray<SkString> fFailures;
92 }; 91 };
93 } // namespace
94 92
95 void Test::run() { 93 void Test::run() {
96 // Clear the Skia error callback before running any test, to ensure that tes ts 94 // Clear the Skia error callback before running any test, to ensure that tes ts
97 // don't have unintended side effects when running more than one. 95 // don't have unintended side effects when running more than one.
98 SkSetErrorCallback( NULL, NULL ); 96 SkSetErrorCallback( NULL, NULL );
99 97
100 // Tell (likely shared) fReporter that this test has started. 98 // Tell (likely shared) fReporter that this test has started.
101 fReporter->startTest(this); 99 fReporter->startTest(this);
102 100
103 const SkMSec start = SkTime::GetMSecs(); 101 const SkMSec start = SkTime::GetMSecs();
(...skipping 25 matching lines...) Expand all
129 #else 127 #else
130 return NULL; 128 return NULL;
131 #endif 129 #endif
132 } 130 }
133 131
134 void GpuTest::DestroyContexts() { 132 void GpuTest::DestroyContexts() {
135 #if SK_SUPPORT_GPU 133 #if SK_SUPPORT_GPU
136 gGrContextFactory.destroyContexts(); 134 gGrContextFactory.destroyContexts();
137 #endif 135 #endif
138 } 136 }
OLDNEW
« tests/PixelRefTest.cpp ('K') | « tests/PixelRefTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698