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 #include "base/test/test_suite.h" | 5 #include "base/test/test_suite.h" |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/base_paths.h" | 8 #include "base/base_paths.h" |
9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 gtk_init_check(&argc, &argv); | 109 gtk_init_check(&argc, &argv); |
110 #endif // defined(TOOLKIT_GTK) | 110 #endif // defined(TOOLKIT_GTK) |
111 | 111 |
112 // On Android, AtExitManager is created in | 112 // On Android, AtExitManager is created in |
113 // testing/android/native_test_wrapper.cc before main() is called. | 113 // testing/android/native_test_wrapper.cc before main() is called. |
114 #if !defined(OS_ANDROID) | 114 #if !defined(OS_ANDROID) |
115 if (create_at_exit_manager) | 115 if (create_at_exit_manager) |
116 at_exit_manager_.reset(new base::AtExitManager); | 116 at_exit_manager_.reset(new base::AtExitManager); |
117 #endif | 117 #endif |
118 | 118 |
| 119 #if defined(OS_IOS) |
| 120 InitIOSRunHook(this, argc, argv); |
| 121 #endif |
| 122 |
119 // Don't add additional code to this function. Instead add it to | 123 // Don't add additional code to this function. Instead add it to |
120 // Initialize(). See bug 6436. | 124 // Initialize(). See bug 6436. |
121 } | 125 } |
122 | 126 |
123 | 127 |
124 // static | 128 // static |
125 bool TestSuite::IsMarkedMaybe(const testing::TestInfo& test) { | 129 bool TestSuite::IsMarkedMaybe(const testing::TestInfo& test) { |
126 return strncmp(test.name(), "MAYBE_", 6) == 0; | 130 return strncmp(test.name(), "MAYBE_", 6) == 0; |
127 } | 131 } |
128 | 132 |
129 void TestSuite::CatchMaybeTests() { | 133 void TestSuite::CatchMaybeTests() { |
130 testing::TestEventListeners& listeners = | 134 testing::TestEventListeners& listeners = |
131 testing::UnitTest::GetInstance()->listeners(); | 135 testing::UnitTest::GetInstance()->listeners(); |
132 listeners.Append(new MaybeTestDisabler); | 136 listeners.Append(new MaybeTestDisabler); |
133 } | 137 } |
134 | 138 |
135 void TestSuite::ResetCommandLine() { | 139 void TestSuite::ResetCommandLine() { |
136 testing::TestEventListeners& listeners = | 140 testing::TestEventListeners& listeners = |
137 testing::UnitTest::GetInstance()->listeners(); | 141 testing::UnitTest::GetInstance()->listeners(); |
138 listeners.Append(new TestClientInitializer); | 142 listeners.Append(new TestClientInitializer); |
139 } | 143 } |
140 | 144 |
141 // Don't add additional code to this method. Instead add it to | 145 // Don't add additional code to this method. Instead add it to |
142 // Initialize(). See bug 6436. | 146 // Initialize(). See bug 6436. |
143 int TestSuite::Run() { | 147 int TestSuite::Run() { |
| 148 #if defined(OS_IOS) |
| 149 RunTestsFromIOSApp(); |
| 150 #endif |
| 151 |
144 #if defined(OS_MACOSX) | 152 #if defined(OS_MACOSX) |
145 base::mac::ScopedNSAutoreleasePool scoped_pool; | 153 base::mac::ScopedNSAutoreleasePool scoped_pool; |
146 #endif | 154 #endif |
147 | 155 |
148 Initialize(); | 156 Initialize(); |
149 std::string client_func = | 157 std::string client_func = |
150 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 158 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
151 switches::kTestChildProcess); | 159 switches::kTestChildProcess); |
152 | 160 |
153 // Check to see if we are being run as a client process. | 161 // Check to see if we are being run as a client process. |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 icu_util::Initialize(); | 250 icu_util::Initialize(); |
243 | 251 |
244 CatchMaybeTests(); | 252 CatchMaybeTests(); |
245 ResetCommandLine(); | 253 ResetCommandLine(); |
246 | 254 |
247 TestTimeouts::Initialize(); | 255 TestTimeouts::Initialize(); |
248 } | 256 } |
249 | 257 |
250 void TestSuite::Shutdown() { | 258 void TestSuite::Shutdown() { |
251 } | 259 } |
OLD | NEW |