OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 SK_DECLARE_INST_COUNT(Reporter) | 25 SK_DECLARE_INST_COUNT(Reporter) |
26 Reporter(); | 26 Reporter(); |
27 | 27 |
28 enum Result { | 28 enum Result { |
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 void bumpTestCount() { sk_atomic_inc(&fTestCount); } | |
36 int countTests() const { return fTestCount; } | 35 int countTests() const { return fTestCount; } |
37 | 36 |
38 void startTest(Test*); | 37 void startTest(Test*); |
39 void report(const char testDesc[], Result); | 38 void report(const char testDesc[], Result); |
40 void endTest(Test*); | 39 void endTest(Test*); |
| 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); } |
| 44 |
43 // helpers for tests | 45 // helpers for tests |
44 void reportFailed(const char desc[]) { | 46 void reportFailed(const char desc[]) { |
45 this->report(desc, kFailed); | 47 this->report(desc, kFailed); |
46 } | 48 } |
47 void reportFailed(const SkString& desc) { | 49 void reportFailed(const SkString& desc) { |
48 this->report(desc.c_str(), kFailed); | 50 this->report(desc.c_str(), kFailed); |
49 } | 51 } |
50 | 52 |
51 | 53 |
52 protected: | 54 protected: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 do { \ | 117 do { \ |
116 if (!(cond)) { \ | 118 if (!(cond)) { \ |
117 SkString desc; \ | 119 SkString desc; \ |
118 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \ | 120 desc.printf("%s %s:%d: %s", message, __FILE__, __LINE__, #cond); \ |
119 r->reportFailed(desc); \ | 121 r->reportFailed(desc); \ |
120 } \ | 122 } \ |
121 } while(0) | 123 } while(0) |
122 | 124 |
123 | 125 |
124 #endif | 126 #endif |
OLD | NEW |