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

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

Issue 7806016: Revert 98826 - Add means for running some tests only o-o-p. Add messaging non-main thread test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | « ppapi/tests/pp_thread.h ('k') | ppapi/tests/test_post_message.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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return new Test##name(instance); \ 123 return new Test##name(instance); \
124 } \ 124 } \
125 static TestCaseFactory g_Test##name_factory( \ 125 static TestCaseFactory g_Test##name_factory( \
126 #name, &Test##name##_FactoryMethod \ 126 #name, &Test##name##_FactoryMethod \
127 ) 127 )
128 128
129 // Helper macro for calling functions implementing specific tests in the 129 // Helper macro for calling functions implementing specific tests in the
130 // RunTest function. This assumes the function name is TestFoo where Foo is the 130 // RunTest function. This assumes the function name is TestFoo where Foo is the
131 // test |name|. 131 // test |name|.
132 #define RUN_TEST(name) \ 132 #define RUN_TEST(name) \
133 do { \ 133 force_async_ = false; \
134 force_async_ = false; \ 134 instance_->LogTest(#name, Test##name());
135 instance_->LogTest(#name, Test##name()); \
136 } while (false)
137 135
138 // Like RUN_TEST above but forces functions taking callbacks to complete 136 // Like RUN_TEST above but forces functions taking callbacks to complete
139 // asynchronously on success or error. 137 // asynchronously on success or error.
140 #define RUN_TEST_FORCEASYNC(name) \ 138 #define RUN_TEST_FORCEASYNC(name) \
141 do { \ 139 force_async_ = true; \
142 force_async_ = true; \ 140 instance_->LogTest(#name"ForceAsync", Test##name());
143 instance_->LogTest(#name"ForceAsync", Test##name()); \
144 } while (false)
145 141
146 #define RUN_TEST_FORCEASYNC_AND_NOT(name) \ 142 #define RUN_TEST_FORCEASYNC_AND_NOT(name) \
147 do { \ 143 RUN_TEST_FORCEASYNC(name); \
148 RUN_TEST_FORCEASYNC(name); \ 144 RUN_TEST(name);
149 RUN_TEST(name); \
150 } while (false)
151 145
152 146
153 // Helper macros for checking values in tests, and returning a location 147 // Helper macros for checking values in tests, and returning a location
154 // description of the test fails. 148 // description of the test fails.
155 #define ASSERT_TRUE(cmd) \ 149 #define ASSERT_TRUE(cmd) \
156 if (!(cmd)) { \ 150 if (!(cmd)) { \
157 return MakeFailureMessage(__FILE__, __LINE__, #cmd); \ 151 return MakeFailureMessage(__FILE__, __LINE__, #cmd); \
158 } 152 }
159 #define ASSERT_FALSE(cmd) ASSERT_TRUE(!(cmd)) 153 #define ASSERT_FALSE(cmd) ASSERT_TRUE(!(cmd))
160 #define ASSERT_EQ(a, b) ASSERT_TRUE((a) == (b)) 154 #define ASSERT_EQ(a, b) ASSERT_TRUE((a) == (b))
161 #define ASSERT_NE(a, b) ASSERT_TRUE((a) != (b)) 155 #define ASSERT_NE(a, b) ASSERT_TRUE((a) != (b))
162 156
163 #define ASSERT_DOUBLE_EQ(a, b) ASSERT_TRUE( \ 157 #define ASSERT_DOUBLE_EQ(a, b) ASSERT_TRUE( \
164 std::fabs((a)-(b)) <= std::numeric_limits<double>::epsilon()) 158 std::fabs((a)-(b)) <= std::numeric_limits<double>::epsilon())
165 159
166 #define PASS() return std::string() 160 #define PASS() return std::string()
167 161
168 #endif // PPAPI_TESTS_TEST_CASE_H_ 162 #endif // PPAPI_TESTS_TEST_CASE_H_
OLDNEW
« no previous file with comments | « ppapi/tests/pp_thread.h ('k') | ppapi/tests/test_post_message.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698