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

Side by Side Diff: ppapi/tests/test_case.h

Issue 8931026: Reverting because I reverted the CL this depends on... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 | « no previous file | ppapi/tests/test_websocket.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_TESTS_TEST_CASE_H_ 5 #ifndef PPAPI_TESTS_TEST_CASE_H_
6 #define PPAPI_TESTS_TEST_CASE_H_ 6 #define PPAPI_TESTS_TEST_CASE_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <string> 10 #include <string>
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 // Helper macro for calling functions implementing specific tests in the 147 // Helper macro for calling functions implementing specific tests in the
148 // RunTest function. This assumes the function name is TestFoo where Foo is the 148 // RunTest function. This assumes the function name is TestFoo where Foo is the
149 // test |name|. 149 // test |name|.
150 #define RUN_TEST(name, test_filter) \ 150 #define RUN_TEST(name, test_filter) \
151 if (MatchesFilter(#name, test_filter)) { \ 151 if (MatchesFilter(#name, test_filter)) { \
152 force_async_ = false; \ 152 force_async_ = false; \
153 instance_->LogTest(#name, Test##name()); \ 153 instance_->LogTest(#name, Test##name()); \
154 } 154 }
155 155
156 #define RUN_TEST_WITH_REFERENCE_CHECK(name, test_filter) \
157 if (MatchesFilter(#name, test_filter)) { \
158 force_async_ = false; \
159 uint32_t objects = testing_interface_->GetLiveObjectsForInstance( \
160 instance_->pp_instance()); \
161 std::string error_message = Test##name(); \
162 if (error_message.empty() && \
163 testing_interface_->GetLiveObjectsForInstance( \
164 instance_->pp_instance()) != objects) \
165 error_message = MakeFailureMessage(__FILE__, __LINE__, \
166 "reference leak check"); \
167 instance_->LogTest(#name, error_message); \
168 }
169
170 // Like RUN_TEST above but forces functions taking callbacks to complete 156 // Like RUN_TEST above but forces functions taking callbacks to complete
171 // asynchronously on success or error. 157 // asynchronously on success or error.
172 #define RUN_TEST_FORCEASYNC(name, test_filter) \ 158 #define RUN_TEST_FORCEASYNC(name, test_filter) \
173 if (MatchesFilter(#name"ForceAsync", test_filter)) { \ 159 if (MatchesFilter(#name"ForceAsync", test_filter)) { \
174 force_async_ = true; \ 160 force_async_ = true; \
175 instance_->LogTest(#name"ForceAsync", Test##name()); \ 161 instance_->LogTest(#name"ForceAsync", Test##name()); \
176 } 162 }
177 163
178 #define RUN_TEST_FORCEASYNC_AND_NOT(name, test_filter) \ 164 #define RUN_TEST_FORCEASYNC_AND_NOT(name, test_filter) \
179 do { \ 165 do { \
(...skipping 11 matching lines...) Expand all
191 #define ASSERT_FALSE(cmd) ASSERT_TRUE(!(cmd)) 177 #define ASSERT_FALSE(cmd) ASSERT_TRUE(!(cmd))
192 #define ASSERT_EQ(a, b) ASSERT_TRUE((a) == (b)) 178 #define ASSERT_EQ(a, b) ASSERT_TRUE((a) == (b))
193 #define ASSERT_NE(a, b) ASSERT_TRUE((a) != (b)) 179 #define ASSERT_NE(a, b) ASSERT_TRUE((a) != (b))
194 180
195 #define ASSERT_DOUBLE_EQ(a, b) ASSERT_TRUE( \ 181 #define ASSERT_DOUBLE_EQ(a, b) ASSERT_TRUE( \
196 std::fabs((a)-(b)) <= std::numeric_limits<double>::epsilon()) 182 std::fabs((a)-(b)) <= std::numeric_limits<double>::epsilon())
197 183
198 #define PASS() return std::string() 184 #define PASS() return std::string()
199 185
200 #endif // PPAPI_TESTS_TEST_CASE_H_ 186 #endif // PPAPI_TESTS_TEST_CASE_H_
OLDNEW
« no previous file with comments | « no previous file | ppapi/tests/test_websocket.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698