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_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. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 logging::InitLogging(log_filename.value().c_str(), | 175 logging::InitLogging(log_filename.value().c_str(), |
176 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, | 176 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, |
177 logging::LOCK_LOG_FILE, | 177 logging::LOCK_LOG_FILE, |
178 logging::DELETE_OLD_LOG_FILE); | 178 logging::DELETE_OLD_LOG_FILE); |
179 // We want process and thread IDs because we may have multiple processes. | 179 // We want process and thread IDs because we may have multiple processes. |
180 // Note: temporarily enabled timestamps in an effort to catch bug 6361. | 180 // Note: temporarily enabled timestamps in an effort to catch bug 6361. |
181 logging::SetLogItems(true, true, true, true); | 181 logging::SetLogItems(true, true, true, true); |
182 | 182 |
183 CHECK(base::EnableInProcessStackDumping()); | 183 CHECK(base::EnableInProcessStackDumping()); |
184 #if defined(OS_WIN) | 184 #if defined(OS_WIN) |
185 // For unit tests we turn on the high resolution timer and disable | 185 // Make sure we run with high resolution timer to minimize differences |
186 // base::Time's use of SystemMonitor. Tests create and destroy the message | 186 // between production code and test code. |
187 // loop, which causes a crash with SystemMonitor (http://crbug.com/12187). | 187 bool result = base::Time::UseHighResolutionTimer(true); |
188 base::Time::EnableHiResClockForTests(); | 188 CHECK(result); |
189 | 189 |
190 // In some cases, we do not want to see standard error dialogs. | 190 // In some cases, we do not want to see standard error dialogs. |
191 if (!IsDebuggerPresent() && | 191 if (!IsDebuggerPresent() && |
192 !CommandLine::ForCurrentProcess()->HasSwitch("show-error-dialogs")) { | 192 !CommandLine::ForCurrentProcess()->HasSwitch("show-error-dialogs")) { |
193 SuppressErrorDialogs(); | 193 SuppressErrorDialogs(); |
194 #if !defined(PURIFY) | 194 #if !defined(PURIFY) |
195 // When the code in this file moved around, bug 6436 resurfaced. | 195 // When the code in this file moved around, bug 6436 resurfaced. |
196 // As a hack workaround, just #ifdef out this code for Purify builds. | 196 // As a hack workaround, just #ifdef out this code for Purify builds. |
197 logging::SetLogAssertHandler(UnitTestAssertHandler); | 197 logging::SetLogAssertHandler(UnitTestAssertHandler); |
198 #endif // !defined(PURIFY) | 198 #endif // !defined(PURIFY) |
(...skipping 13 matching lines...) Expand all Loading... |
212 | 212 |
213 virtual void Shutdown() { | 213 virtual void Shutdown() { |
214 } | 214 } |
215 | 215 |
216 // Make sure that we setup an AtExitManager so Singleton objects will be | 216 // Make sure that we setup an AtExitManager so Singleton objects will be |
217 // destroyed. | 217 // destroyed. |
218 base::AtExitManager at_exit_manager_; | 218 base::AtExitManager at_exit_manager_; |
219 }; | 219 }; |
220 | 220 |
221 #endif // BASE_TEST_SUITE_H_ | 221 #endif // BASE_TEST_SUITE_H_ |
OLD | NEW |