OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_SUITE_H_ | 5 #ifndef BASE_TEST_SUITE_H_ |
6 #define BASE_TEST_SUITE_H_ | 6 #define BASE_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. |
11 | 11 |
12 #include "base/at_exit.h" | 12 #include "base/at_exit.h" |
13 #include "base/base_paths.h" | 13 #include "base/base_paths.h" |
14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
15 #include "base/debug_on_start.h" | 15 #include "base/debug_on_start.h" |
16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
17 #include "base/icu_util.h" | 17 #include "base/icu_util.h" |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #include "base/multiprocess_test.h" | 19 #include "base/multiprocess_test.h" |
20 #include "base/scoped_nsautorelease_pool.h" | 20 #include "base/scoped_nsautorelease_pool.h" |
21 #include "base/time.h" | 21 #include "base/time.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
23 #include "testing/multiprocess_func_list.h" | 23 #include "testing/multiprocess_func_list.h" |
24 | 24 |
25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
26 #include <windows.h> | 26 #include <windows.h> |
27 #elif defined(OS_LINUX) | 27 #elif defined(OS_LINUX) || defined(OS_OPENBSD) |
28 #include <gtk/gtk.h> | 28 #include <gtk/gtk.h> |
29 #endif | 29 #endif |
30 | 30 |
31 class TestSuite { | 31 class TestSuite { |
32 public: | 32 public: |
33 TestSuite(int argc, char** argv) { | 33 TestSuite(int argc, char** argv) { |
34 base::EnableTerminationOnHeapCorruption(); | 34 base::EnableTerminationOnHeapCorruption(); |
35 CommandLine::Init(argc, argv); | 35 CommandLine::Init(argc, argv); |
36 testing::InitGoogleTest(&argc, argv); | 36 testing::InitGoogleTest(&argc, argv); |
37 #if defined(OS_LINUX) | 37 #if defined(OS_LINUX) || defined(OS_OPENBSD) |
38 gtk_init_check(&argc, &argv); | 38 gtk_init_check(&argc, &argv); |
39 #endif | 39 #endif |
40 // Don't add additional code to this constructor. Instead add it to | 40 // Don't add additional code to this constructor. Instead add it to |
41 // Initialize(). See bug 6436. | 41 // Initialize(). See bug 6436. |
42 } | 42 } |
43 | 43 |
44 virtual ~TestSuite() { | 44 virtual ~TestSuite() { |
45 CommandLine::Terminate(); | 45 CommandLine::Terminate(); |
46 } | 46 } |
47 | 47 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 virtual void Shutdown() { | 132 virtual void Shutdown() { |
133 } | 133 } |
134 | 134 |
135 // Make sure that we setup an AtExitManager so Singleton objects will be | 135 // Make sure that we setup an AtExitManager so Singleton objects will be |
136 // destroyed. | 136 // destroyed. |
137 base::AtExitManager at_exit_manager_; | 137 base::AtExitManager at_exit_manager_; |
138 }; | 138 }; |
139 | 139 |
140 #endif // BASE_TEST_SUITE_H_ | 140 #endif // BASE_TEST_SUITE_H_ |
OLD | NEW |