OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 scoped_ptr<base::ShadowingAtExitManager> exit_manager_; | 50 scoped_ptr<base::ShadowingAtExitManager> exit_manager_; |
51 }; | 51 }; |
52 | 52 |
53 class TestSuite { | 53 class TestSuite { |
54 public: | 54 public: |
55 TestSuite(int argc, char** argv) { | 55 TestSuite(int argc, char** argv) { |
56 base::EnableTerminationOnHeapCorruption(); | 56 base::EnableTerminationOnHeapCorruption(); |
57 CommandLine::Init(argc, argv); | 57 CommandLine::Init(argc, argv); |
58 testing::InitGoogleTest(&argc, argv); | 58 testing::InitGoogleTest(&argc, argv); |
59 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 59 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
60 g_thread_init(NULL); | 60 if (!g_thread_supported()) { |
61 gtk_init_check(&argc, &argv); | 61 g_thread_init(NULL); |
| 62 gtk_init_check(&argc, &argv); |
| 63 } |
62 #endif // defined(OS_LINUX) | 64 #endif // defined(OS_LINUX) |
63 // Don't add additional code to this constructor. Instead add it to | 65 // Don't add additional code to this constructor. Instead add it to |
64 // Initialize(). See bug 6436. | 66 // Initialize(). See bug 6436. |
65 } | 67 } |
66 | 68 |
67 virtual ~TestSuite() { | 69 virtual ~TestSuite() { |
68 CommandLine::Reset(); | 70 CommandLine::Reset(); |
69 } | 71 } |
70 | 72 |
71 // Returns true if a string starts with FLAKY_. | 73 // Returns true if a string starts with FLAKY_. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 222 |
221 virtual void Shutdown() { | 223 virtual void Shutdown() { |
222 } | 224 } |
223 | 225 |
224 // Make sure that we setup an AtExitManager so Singleton objects will be | 226 // Make sure that we setup an AtExitManager so Singleton objects will be |
225 // destroyed. | 227 // destroyed. |
226 base::AtExitManager at_exit_manager_; | 228 base::AtExitManager at_exit_manager_; |
227 }; | 229 }; |
228 | 230 |
229 #endif // BASE_TEST_TEST_SUITE_H_ | 231 #endif // BASE_TEST_TEST_SUITE_H_ |
OLD | NEW |