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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cmath> | 10 #include <cmath> |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 | 190 |
191 private: | 191 private: |
192 void Run() { | 192 void Run() { |
193 int32_t result = loop_.AttachToCurrentThread(); | 193 int32_t result = loop_.AttachToCurrentThread(); |
194 static_cast<void>(result); // result is not used in the RELEASE build. | 194 static_cast<void>(result); // result is not used in the RELEASE build. |
195 PP_DCHECK(PP_OK == result); | 195 PP_DCHECK(PP_OK == result); |
196 result_ = (test_case_->*test_to_run_)(); | 196 result_ = (test_case_->*test_to_run_)(); |
197 // Now give the loop a chance to clean up. | 197 // Now give the loop a chance to clean up. |
198 loop_.PostQuit(true /* should_destroy */); | 198 loop_.PostQuit(true /* should_destroy */); |
199 loop_.Run(); | 199 loop_.Run(); |
200 // Tell the main thread to quit its nested message loop, now that the test | 200 // Tell the main thread to quit its nested run loop, now that the test |
201 // is complete. | 201 // is complete. |
202 TestCase::QuitMainMessageLoop(instance_); | 202 TestCase::QuitMainMessageLoop(instance_); |
203 } | 203 } |
204 | 204 |
205 std::string result_; | 205 std::string result_; |
206 PP_Instance instance_; | 206 PP_Instance instance_; |
207 T* test_case_; | 207 T* test_case_; |
208 TestMethodType test_to_run_; | 208 TestMethodType test_to_run_; |
209 pp::MessageLoop loop_; | 209 pp::MessageLoop loop_; |
210 }; | 210 }; |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 #define ASSERT_SUBTEST_SUCCESS(function) \ | 736 #define ASSERT_SUBTEST_SUCCESS(function) \ |
737 do { \ | 737 do { \ |
738 std::string result = (function); \ | 738 std::string result = (function); \ |
739 if (!result.empty()) \ | 739 if (!result.empty()) \ |
740 return TestCase::MakeFailureMessage(__FILE__, __LINE__, result.c_str()); \ | 740 return TestCase::MakeFailureMessage(__FILE__, __LINE__, result.c_str()); \ |
741 } while (false) | 741 } while (false) |
742 | 742 |
743 #define PASS() return std::string() | 743 #define PASS() return std::string() |
744 | 744 |
745 #endif // PPAPI_TESTS_TEST_CASE_H_ | 745 #endif // PPAPI_TESTS_TEST_CASE_H_ |
OLD | NEW |