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 12 matching lines...) Expand all Loading... |
23 | 23 |
24 // Instantiates TestSuite, runs it and returns exit code. | 24 // Instantiates TestSuite, runs it and returns exit code. |
25 int RunUnitTestsUsingBaseTestSuite(int argc, char **argv); | 25 int RunUnitTestsUsingBaseTestSuite(int argc, char **argv); |
26 | 26 |
27 class TestSuite { | 27 class TestSuite { |
28 public: | 28 public: |
29 // Match function used by the GetTestCount method. | 29 // Match function used by the GetTestCount method. |
30 typedef bool (*TestMatch)(const testing::TestInfo&); | 30 typedef bool (*TestMatch)(const testing::TestInfo&); |
31 | 31 |
32 TestSuite(int argc, char** argv); | 32 TestSuite(int argc, char** argv); |
33 #if defined(OS_WIN) | |
34 TestSuite(int argc, wchar_t** argv); | |
35 #endif // defined(OS_WIN) | |
36 virtual ~TestSuite(); | 33 virtual ~TestSuite(); |
37 | 34 |
38 // Returns true if the test is marked as "MAYBE_". | 35 // Returns true if the test is marked as "MAYBE_". |
39 // When using different prefixes depending on platform, we use MAYBE_ and | 36 // When using different prefixes depending on platform, we use MAYBE_ and |
40 // preprocessor directives to replace MAYBE_ with the target prefix. | 37 // preprocessor directives to replace MAYBE_ with the target prefix. |
41 static bool IsMarkedMaybe(const testing::TestInfo& test); | 38 static bool IsMarkedMaybe(const testing::TestInfo& test); |
42 | 39 |
43 void CatchMaybeTests(); | 40 void CatchMaybeTests(); |
44 | 41 |
45 void ResetCommandLine(); | 42 void ResetCommandLine(); |
(...skipping 21 matching lines...) Expand all Loading... |
67 | 64 |
68 virtual void Initialize(); | 65 virtual void Initialize(); |
69 virtual void Shutdown(); | 66 virtual void Shutdown(); |
70 | 67 |
71 // Make sure that we setup an AtExitManager so Singleton objects will be | 68 // Make sure that we setup an AtExitManager so Singleton objects will be |
72 // destroyed. | 69 // destroyed. |
73 scoped_ptr<base::AtExitManager> at_exit_manager_; | 70 scoped_ptr<base::AtExitManager> at_exit_manager_; |
74 | 71 |
75 private: | 72 private: |
76 void InitializeFromCommandLine(int argc, char** argv); | 73 void InitializeFromCommandLine(int argc, char** argv); |
77 #if defined(OS_WIN) | |
78 void InitializeFromCommandLine(int argc, wchar_t** argv); | |
79 #endif // defined(OS_WIN) | |
80 | 74 |
81 // Basic initialization for the test suite happens here. | 75 // Basic initialization for the test suite happens here. |
82 void PreInitialize(bool create_at_exit_manager); | 76 void PreInitialize(bool create_at_exit_manager); |
83 | 77 |
84 test::TraceToFile trace_to_file_; | 78 test::TraceToFile trace_to_file_; |
85 | 79 |
86 bool initialized_command_line_; | 80 bool initialized_command_line_; |
87 | 81 |
88 DISALLOW_COPY_AND_ASSIGN(TestSuite); | 82 DISALLOW_COPY_AND_ASSIGN(TestSuite); |
89 }; | 83 }; |
90 | 84 |
91 } // namespace base | 85 } // namespace base |
92 | 86 |
93 #endif // BASE_TEST_TEST_SUITE_H_ | 87 #endif // BASE_TEST_TEST_SUITE_H_ |
OLD | NEW |