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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 kNative_GPUTestContexts = 1 << 2, | 78 kNative_GPUTestContexts = 1 << 2, |
79 kOther_GPUTestContexts = 1 << 3, // Other than native, used only for
below. | 79 kOther_GPUTestContexts = 1 << 3, // Other than native, used only for
below. |
80 kAllRendering_GPUTestContexts = kNative_GPUTestContexts | kOther_GPUTestCont
exts, | 80 kAllRendering_GPUTestContexts = kNative_GPUTestContexts | kOther_GPUTestCont
exts, |
81 kAll_GPUTestContexts = kAllRendering_GPUTestContexts | 81 kAll_GPUTestContexts = kAllRendering_GPUTestContexts |
82 | kNull_GPUTestContexts | 82 | kNull_GPUTestContexts |
83 | kDebug_GPUTestContexts | 83 | kDebug_GPUTestContexts |
84 }; | 84 }; |
85 template<typename T> | 85 template<typename T> |
86 void RunWithGPUTestContexts(T testFunction, GPUTestContexts contexts, Reporter*
reporter, | 86 void RunWithGPUTestContexts(T testFunction, GPUTestContexts contexts, Reporter*
reporter, |
87 GrContextFactory* factory); | 87 GrContextFactory* factory); |
| 88 |
| 89 /** Timer provides wall-clock duration since its creation. */ |
| 90 class Timer { |
| 91 public: |
| 92 /** Starts the timer. */ |
| 93 Timer(); |
| 94 |
| 95 /** Nanoseconds since creation. */ |
| 96 double elapsedNs() const; |
| 97 |
| 98 /** Milliseconds since creation. */ |
| 99 double elapsedMs() const; |
| 100 |
| 101 /** Milliseconds since creation as an integer. |
| 102 Behavior is undefined for durations longer than SK_MSecMax. |
| 103 */ |
| 104 SkMSec elapsedMsInt() const; |
| 105 private: |
| 106 double fStartNanos; |
| 107 }; |
| 108 |
88 } // namespace skiatest | 109 } // namespace skiatest |
89 | 110 |
90 #define REPORTER_ASSERT(r, cond) \ | 111 #define REPORTER_ASSERT(r, cond) \ |
91 do { \ | 112 do { \ |
92 if (!(cond)) { \ | 113 if (!(cond)) { \ |
93 REPORT_FAILURE(r, #cond, SkString()); \ | 114 REPORT_FAILURE(r, #cond, SkString()); \ |
94 } \ | 115 } \ |
95 } while (0) | 116 } while (0) |
96 | 117 |
97 #define REPORTER_ASSERT_MESSAGE(r, cond, message) \ | 118 #define REPORTER_ASSERT_MESSAGE(r, cond, message) \ |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 do { \ | 179 do { \ |
159 SkDynamicMemoryWStream testStream; \ | 180 SkDynamicMemoryWStream testStream; \ |
160 SkAutoTUnref<SkDocument> testDoc(SkDocument::CreatePDF(&testStream)); \ | 181 SkAutoTUnref<SkDocument> testDoc(SkDocument::CreatePDF(&testStream)); \ |
161 if (!testDoc) { \ | 182 if (!testDoc) { \ |
162 INFOF(REPORTER, "PDF disabled; %s test skipped.", #TEST_NAME); \ | 183 INFOF(REPORTER, "PDF disabled; %s test skipped.", #TEST_NAME); \ |
163 return; \ | 184 return; \ |
164 } \ | 185 } \ |
165 } while (false) | 186 } while (false) |
166 | 187 |
167 #endif | 188 #endif |
OLD | NEW |