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

Side by Side Diff: tests/Test.h

Issue 319473003: Clean up Test's resourcePath code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | tests/Test.cpp » ('j') | 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 #ifndef skiatest_Test_DEFINED 8 #ifndef skiatest_Test_DEFINED
9 #define skiatest_Test_DEFINED 9 #define skiatest_Test_DEFINED
10 10
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 Reporter* getReporter() const { return fReporter; } 55 Reporter* getReporter() const { return fReporter; }
56 void setReporter(Reporter*); 56 void setReporter(Reporter*);
57 57
58 const char* getName(); 58 const char* getName();
59 void run(); 59 void run();
60 bool passed() const { return fPassed; } 60 bool passed() const { return fPassed; }
61 SkMSec elapsedMs() const { return fElapsed; } 61 SkMSec elapsedMs() const { return fElapsed; }
62 62
63 static SkString GetTmpDir(); 63 static SkString GetTmpDir();
64 64
65 static void SetResourcePath(const char*); 65 static void SetResourcePath(const char* resourcePath) {
mtklein 2014/06/05 12:55:33 I wouldn't bother with the churn? There's not goi
tfarina 2014/06/06 01:53:10 Done.
66 static SkString GetResourcePath(); 66 gResourcePath = resourcePath;
67 }
68 static SkString& GetResourcePath() { return gResourcePath; }
mtklein 2014/06/05 12:55:33 SkString is fine to return by value, especially he
tfarina 2014/06/06 01:53:10 Done.
67 69
68 virtual bool isGPUTest() const { return false; } 70 virtual bool isGPUTest() const { return false; }
69 virtual void setGrContextFactory(GrContextFactory* factory) {} 71 virtual void setGrContextFactory(GrContextFactory* factory) {}
70 72
71 protected: 73 protected:
72 virtual void onGetName(SkString*) = 0; 74 virtual void onGetName(SkString*) = 0;
73 virtual void onRun(Reporter*) = 0; 75 virtual void onRun(Reporter*) = 0;
74 76
75 private: 77 private:
78 static SkString gResourcePath;
mtklein 2014/06/05 12:55:33 Let's turn this back into a static const char*. I
tfarina 2014/06/06 01:53:10 Done.
79
76 Reporter* fReporter; 80 Reporter* fReporter;
77 SkString fName; 81 SkString fName;
78 bool fPassed; 82 bool fPassed;
79 SkMSec fElapsed; 83 SkMSec fElapsed;
80 }; 84 };
81 85
82 class GpuTest : public Test{ 86 class GpuTest : public Test{
83 public: 87 public:
84 GpuTest() : Test(), fGrContextFactory(NULL) {} 88 GpuTest() : Test(), fGrContextFactory(NULL) {}
85 89
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } \ 173 } \
170 virtual void onRun(Reporter* r) SK_OVERRIDE { \ 174 virtual void onRun(Reporter* r) SK_OVERRIDE { \
171 name(r, fGrContextFactory); \ 175 name(r, fGrContextFactory); \
172 } \ 176 } \
173 }; \ 177 }; \
174 static TestRegistry gReg_##name##Class(name##Class::Factory); \ 178 static TestRegistry gReg_##name##Class(name##Class::Factory); \
175 } \ 179 } \
176 static void name(skiatest::Reporter* reporter, GrContextFactory* factory) 180 static void name(skiatest::Reporter* reporter, GrContextFactory* factory)
177 181
178 #endif 182 #endif
OLDNEW
« no previous file with comments | « no previous file | tests/Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698