| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 // RUN_TEST* macros. | 56 // RUN_TEST* macros. |
| 57 virtual void RunTests(const std::string& test_filter) = 0; | 57 virtual void RunTests(const std::string& test_filter) = 0; |
| 58 | 58 |
| 59 static std::string MakeFailureMessage(const char* file, int line, | 59 static std::string MakeFailureMessage(const char* file, int line, |
| 60 const char* cmd); | 60 const char* cmd); |
| 61 | 61 |
| 62 #if !(defined __native_client__) | 62 #if !(defined __native_client__) |
| 63 // Returns the scriptable test object for the current test, if any. | 63 // Returns the scriptable test object for the current test, if any. |
| 64 // Internally, this uses CreateTestObject which each test overrides. | 64 // Internally, this uses CreateTestObject which each test overrides. |
| 65 pp::VarPrivate GetTestObject(); | 65 pp::VarPrivate GetTestObject(); |
| 66 void ResetTestObject() { test_object_ = pp::VarPrivate(); } |
| 66 #endif | 67 #endif |
| 67 | 68 |
| 68 // A function that is invoked whenever HandleMessage is called on the | 69 // A function that is invoked whenever HandleMessage is called on the |
| 69 // associated TestingInstance. Default implementation does nothing. TestCases | 70 // associated TestingInstance. Default implementation does nothing. TestCases |
| 70 // that want to handle incoming postMessage events should override this | 71 // that want to handle incoming postMessage events should override this |
| 71 // method. | 72 // method. |
| 72 virtual void HandleMessage(const pp::Var& message_data); | 73 virtual void HandleMessage(const pp::Var& message_data); |
| 73 | 74 |
| 74 // A function that is invoked whenever DidChangeView is called on the | 75 // A function that is invoked whenever DidChangeView is called on the |
| 75 // associated TestingInstance. Default implementation does nothing. TestCases | 76 // associated TestingInstance. Default implementation does nothing. TestCases |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 #define ASSERT_SUBTEST_SUCCESS(function) \ | 735 #define ASSERT_SUBTEST_SUCCESS(function) \ |
| 735 do { \ | 736 do { \ |
| 736 std::string result = (function); \ | 737 std::string result = (function); \ |
| 737 if (!result.empty()) \ | 738 if (!result.empty()) \ |
| 738 return TestCase::MakeFailureMessage(__FILE__, __LINE__, result.c_str()); \ | 739 return TestCase::MakeFailureMessage(__FILE__, __LINE__, result.c_str()); \ |
| 739 } while (false) | 740 } while (false) |
| 740 | 741 |
| 741 #define PASS() return std::string() | 742 #define PASS() return std::string() |
| 742 | 743 |
| 743 #endif // PPAPI_TESTS_TEST_CASE_H_ | 744 #endif // PPAPI_TESTS_TEST_CASE_H_ |
| OLD | NEW |