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 BASE_GTEST_PROD_UTIL_H_ | 5 #ifndef BASE_GTEST_PROD_UTIL_H_ |
6 #define BASE_GTEST_PROD_UTIL_H_ | 6 #define BASE_GTEST_PROD_UTIL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "testing/gtest/include/gtest/gtest_prod.h" | 9 #include "testing/gtest/include/gtest/gtest_prod.h" |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 // bool private_var; | 34 // bool private_var; |
35 // }; | 35 // }; |
36 // } // namespace foo | 36 // } // namespace foo |
37 // | 37 // |
38 // class MyClassTest::TestMethod() { | 38 // class MyClassTest::TestMethod() { |
39 // foo::MyClass foo_class; | 39 // foo::MyClass foo_class; |
40 // foo_class.private_var = true; | 40 // foo_class.private_var = true; |
41 // } | 41 // } |
42 // | 42 // |
43 // Unless you forward declare MyClassTest::TestMethod outside of namespace foo. | 43 // Unless you forward declare MyClassTest::TestMethod outside of namespace foo. |
44 // Use FORWARD_DECLARE_TEST_ALL_PREFIXES to do so for all possible prefixes. | 44 // Use FORWARD_DECLARE_TEST to do so for all possible prefixes. |
45 // | 45 // |
46 // Example usage: | 46 // Example usage: |
47 // | 47 // |
48 // FORWARD_DECLARE_TEST_ALL_PREFIXES(MyClassTest, TestMethod); | 48 // FORWARD_DECLARE_TEST(MyClassTest, TestMethod); |
49 // | 49 // |
50 // namespace foo { | 50 // namespace foo { |
51 // class MyClass { | 51 // class MyClass { |
52 // private: | 52 // private: |
53 // FRIEND_TEST_ALL_PREFIXES(::MyClassTest, TestMethod); // NOTE use of :: | 53 // FRIEND_TEST_ALL_PREFIXES(::MyClassTest, TestMethod); // NOTE use of :: |
54 // bool private_var; | 54 // bool private_var; |
55 // }; | 55 // }; |
56 // } // namespace foo | 56 // } // namespace foo |
57 // | 57 // |
58 // class MyClassTest::TestMethod() { | 58 // class MyClassTest::TestMethod() { |
59 // foo::MyClass foo_class; | 59 // foo::MyClass foo_class; |
60 // foo_class.private_var = true; | 60 // foo_class.private_var = true; |
61 // } | 61 // } |
62 | 62 |
63 #define FORWARD_DECLARE_TEST(test_case_name, test_name) \ | 63 #define FORWARD_DECLARE_TEST(test_case_name, test_name) \ |
64 class test_case_name##_##test_name##_Test\ | 64 class test_case_name##_##test_name##_Test; \ |
65 | 65 class test_case_name##_##DISABLED_##test_name##_Test; \ |
66 #define FORWARD_DECLARE_TEST_ALL_PREFIXES(test_case_name, test_name) \ | 66 class test_case_name##_##FLAKY_##test_name##_Test; \ |
67 FORWARD_DECLARE_TEST(test_case_name, test_name); \ | 67 class test_case_name##_##FAILS_##test_name##_Test |
68 FORWARD_DECLARE_TEST(test_case_name, DISABLED_##test_name); \ | |
69 FORWARD_DECLARE_TEST(test_case_name, FLAKY_##test_name); \ | |
70 FORWARD_DECLARE_TEST(test_case_name, FAILS_##test_name) | |
71 | 68 |
72 #endif // BASE_GTEST_PROD_UTIL_H_ | 69 #endif // BASE_GTEST_PROD_UTIL_H_ |
OLD | NEW |