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_TEST_TEST_SUITE_H_ | 5 #ifndef BASE_TEST_TEST_SUITE_H_ |
6 #define BASE_TEST_TEST_SUITE_H_ | 6 #define BASE_TEST_TEST_SUITE_H_ |
7 | 7 |
8 // Defines a basic test suite framework for running gtest based tests. You can | 8 // Defines a basic test suite framework for running gtest based tests. You can |
9 // instantiate this class in your main function and call its Run method to run | 9 // instantiate this class in your main function and call its Run method to run |
10 // any gtest based tests that are linked into your executable. | 10 // any gtest based tests that are linked into your executable. |
(...skipping 17 matching lines...) Expand all Loading... |
28 TestSuite(int argc, char** argv); | 28 TestSuite(int argc, char** argv); |
29 virtual ~TestSuite(); | 29 virtual ~TestSuite(); |
30 | 30 |
31 // Returns true if the test is marked as "MAYBE_". | 31 // Returns true if the test is marked as "MAYBE_". |
32 // When using different prefixes depending on platform, we use MAYBE_ and | 32 // When using different prefixes depending on platform, we use MAYBE_ and |
33 // preprocessor directives to replace MAYBE_ with the target prefix. | 33 // preprocessor directives to replace MAYBE_ with the target prefix. |
34 static bool IsMarkedMaybe(const testing::TestInfo& test); | 34 static bool IsMarkedMaybe(const testing::TestInfo& test); |
35 | 35 |
36 void CatchMaybeTests(); | 36 void CatchMaybeTests(); |
37 | 37 |
| 38 // Disables tests that match the |filter|. This gives the test suite an |
| 39 // opportunity to disable tests at runtime. Must be called before Run() |
| 40 // to take effect. |
| 41 // |
| 42 // For example, to disable "FooTest" when IsFooSupported() is false: |
| 43 // if (!IsFooSupported()) |
| 44 // DisableTests("FooTest.*"); |
| 45 // Run(); |
| 46 void DisableTests(const std::string& filter); |
| 47 |
38 void ResetCommandLine(); | 48 void ResetCommandLine(); |
39 | 49 |
40 void AddTestLauncherResultPrinter(); | 50 void AddTestLauncherResultPrinter(); |
41 | 51 |
42 int Run(); | 52 int Run(); |
43 | 53 |
44 protected: | 54 protected: |
45 // This constructor is only accessible to specialized test suite | 55 // This constructor is only accessible to specialized test suite |
46 // implementations which need to control the creation of an AtExitManager | 56 // implementations which need to control the creation of an AtExitManager |
47 // instance for the duration of the test. | 57 // instance for the duration of the test. |
(...skipping 26 matching lines...) Expand all Loading... |
74 DISALLOW_COPY_AND_ASSIGN(TestSuite); | 84 DISALLOW_COPY_AND_ASSIGN(TestSuite); |
75 }; | 85 }; |
76 | 86 |
77 } // namespace base | 87 } // namespace base |
78 | 88 |
79 // TODO(brettw) remove this. This is a temporary hack to allow WebKit to compile | 89 // TODO(brettw) remove this. This is a temporary hack to allow WebKit to compile |
80 // until we can update it to use "base::" (preventing a two-sided patch). | 90 // until we can update it to use "base::" (preventing a two-sided patch). |
81 using base::TestSuite; | 91 using base::TestSuite; |
82 | 92 |
83 #endif // BASE_TEST_TEST_SUITE_H_ | 93 #endif // BASE_TEST_TEST_SUITE_H_ |
OLD | NEW |