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

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: 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/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 {
29 kPassed, // must begin with 0
30 kFailed,
31 /////
32 kLastResult = kFailed
33 };
34
35 int countTests() const { return fTestCount; } 28 int countTests() const { return fTestCount; }
36 29
37 void startTest(Test*); 30 void startTest(Test*);
38 void report(const char testDesc[], Result); 31 void reportFailed(const SkString& desc);
39 void endTest(Test*); 32 void endTest(Test*);
40 33
41 virtual bool allowExtendedTest() const { return false; } 34 virtual bool allowExtendedTest() const { return false; }
42 virtual bool allowThreaded() const { return false; } 35 virtual bool allowThreaded() const { return false; }
43 virtual void bumpTestCount() { sk_atomic_inc(&fTestCount); } 36 virtual void bumpTestCount() { sk_atomic_inc(&fTestCount); }
44 37
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: 38 protected:
55 virtual void onStart(Test*) {} 39 virtual void onStart(Test*) {}
56 virtual void onReport(const char desc[], Result) {} 40 virtual void onReportFailed(const SkString& desc) {}
57 virtual void onEnd(Test*) {} 41 virtual void onEnd(Test*) {}
58 42
59 private: 43 private:
60 int32_t fTestCount; 44 int32_t fTestCount;
61 45
62 typedef SkRefCnt INHERITED; 46 typedef SkRefCnt INHERITED;
63 }; 47 };
64 48
65 class Test { 49 class Test {
66 public: 50 public:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 do { \ 101 do { \
118 if (!(cond)) { \ 102 if (!(cond)) { \
119 SkString desc; \ 103 SkString desc; \
120 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \ 104 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \
121 r->reportFailed(desc); \ 105 r->reportFailed(desc); \
122 } \ 106 } \
123 } while(0) 107 } while(0)
124 108
125 109
126 #endif 110 #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