OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <map> | 10 #include <map> |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 test_to_run_(test_to_run), | 180 test_to_run_(test_to_run), |
181 loop_(loop) { | 181 loop_(loop) { |
182 } | 182 } |
183 const std::string& result() { return result_; } | 183 const std::string& result() { return result_; } |
184 static void ThreadFunction(void* runner) { | 184 static void ThreadFunction(void* runner) { |
185 static_cast<ThreadedTestRunner<T>*>(runner)->Run(); | 185 static_cast<ThreadedTestRunner<T>*>(runner)->Run(); |
186 } | 186 } |
187 | 187 |
188 private: | 188 private: |
189 void Run() { | 189 void Run() { |
190 PP_DCHECK(PP_OK == loop_.AttachToCurrentThread()); | 190 int32_t result = loop_.AttachToCurrentThread(); |
| 191 static_cast<void>(result); // result is not used in the RELEASE build. |
| 192 PP_DCHECK(PP_OK == result); |
191 result_ = (test_case_->*test_to_run_)(); | 193 result_ = (test_case_->*test_to_run_)(); |
192 // Now give the loop a chance to clean up. | 194 // Now give the loop a chance to clean up. |
193 loop_.PostQuit(true /* should_destroy */); | 195 loop_.PostQuit(true /* should_destroy */); |
194 loop_.Run(); | 196 loop_.Run(); |
195 // Tell the main thread to quit its nested message loop, now that the test | 197 // Tell the main thread to quit its nested message loop, now that the test |
196 // is complete. | 198 // is complete. |
197 TestCase::QuitMainMessageLoop(instance_); | 199 TestCase::QuitMainMessageLoop(instance_); |
198 } | 200 } |
199 | 201 |
200 std::string result_; | 202 std::string result_; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 #define ASSERT_SUBTEST_SUCCESS(function) \ | 384 #define ASSERT_SUBTEST_SUCCESS(function) \ |
383 do { \ | 385 do { \ |
384 std::string result = (function); \ | 386 std::string result = (function); \ |
385 if (!result.empty()) \ | 387 if (!result.empty()) \ |
386 return result; \ | 388 return result; \ |
387 } while (false) | 389 } while (false) |
388 | 390 |
389 #define PASS() return std::string() | 391 #define PASS() return std::string() |
390 | 392 |
391 #endif // PPAPI_TESTS_TEST_CASE_H_ | 393 #endif // PPAPI_TESTS_TEST_CASE_H_ |
OLD | NEW |