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

Side by Side Diff: tests/Test.h

Issue 1811613004: Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Rebase. Created 4 years, 9 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 | « tests/StrokerTest.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
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW
« no previous file with comments | « tests/StrokerTest.cpp ('k') | tests/Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698