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

Side by Side Diff: tests/Test.h

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: 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/StreamTest.cpp ('k') | 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
11 #include "SkRefCnt.h" 11 #include "SkRefCnt.h"
12 #include "SkString.h" 12 #include "SkString.h"
13 #include "SkTRegistry.h" 13 #include "SkTRegistry.h"
14 #include "SkThread.h" 14 #include "SkThread.h"
15 #include "SkTypes.h" 15 #include "SkTypes.h"
16 16
17 class GrContextFactory; 17 class GrContextFactory;
18 18
19 namespace skiatest { 19 namespace skiatest {
20 20
21 class Test; 21 class Test;
22 22
23 class Reporter : public SkRefCnt { 23 class Reporter : public SkRefCnt {
24 public: 24 public:
25 SK_DECLARE_INST_COUNT(Reporter) 25 SK_DECLARE_INST_COUNT(Reporter)
26 Reporter(); 26 Reporter();
27 27
28 enum Result { 28 enum Result {
bungeman-skia 2013/06/18 19:52:33 This enum doesn't appear to be used anymore, it sh
mtklein 2013/06/18 20:02:47 Done.
29 kPassed, // must begin with 0 29 kPassed, // must begin with 0
30 kFailed, 30 kFailed,
31 ///// 31 /////
32 kLastResult = kFailed 32 kLastResult = kFailed
33 }; 33 };
34 34
35 int countTests() const { return fTestCount; } 35 int countTests() const { return fTestCount; }
36 36
37 void startTest(Test*); 37 void startTest(Test*);
38 void report(const char testDesc[], Result); 38 void reportFailed(const SkString& desc);
39 void endTest(Test*); 39 void endTest(Test*);
40 40
41 virtual bool allowExtendedTest() const { return false; } 41 virtual bool allowExtendedTest() const { return false; }
42 virtual bool allowThreaded() const { return false; } 42 virtual bool allowThreaded() const { return false; }
43 virtual void bumpTestCount() { sk_atomic_inc(&fTestCount); } 43 virtual void bumpTestCount() { sk_atomic_inc(&fTestCount); }
44 44
45 // helpers for tests
46 void reportFailed(const char desc[]) {
47 this->report(desc, kFailed);
48 }
49 void reportFailed(const SkString& desc) {
50 this->report(desc.c_str(), kFailed);
51 }
52
53
54 protected: 45 protected:
55 virtual void onStart(Test*) {} 46 virtual void onStart(Test*) {}
56 virtual void onReport(const char desc[], Result) {} 47 virtual void onReport(const char desc[], Result) {}
bungeman-skia 2013/06/18 19:52:33 Since we might be mucking with onReport anyway, it
mtklein 2013/06/18 20:02:47 Done.
57 virtual void onEnd(Test*) {} 48 virtual void onEnd(Test*) {}
58 49
59 private: 50 private:
60 int32_t fTestCount; 51 int32_t fTestCount;
61 52
62 typedef SkRefCnt INHERITED; 53 typedef SkRefCnt INHERITED;
63 }; 54 };
64 55
65 class Test { 56 class Test {
66 public: 57 public:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 do { \ 108 do { \
118 if (!(cond)) { \ 109 if (!(cond)) { \
119 SkString desc; \ 110 SkString desc; \
120 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \ 111 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \
121 r->reportFailed(desc); \ 112 r->reportFailed(desc); \
122 } \ 113 } \
123 } while(0) 114 } while(0)
124 115
125 116
126 #endif 117 #endif
OLDNEW
« no previous file with comments | « tests/StreamTest.cpp ('k') | tests/Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698