Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: base/test_suite.h

Issue 113824: Do not monitor system power state during unit tests. (Closed)
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/time.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
22 #include "testing/multiprocess_func_list.h" 23 #include "testing/multiprocess_func_list.h"
23 24
24 #if defined(OS_WIN) 25 #if defined(OS_WIN)
25 #include <windows.h> 26 #include <windows.h>
26 #elif defined(OS_LINUX) 27 #elif defined(OS_LINUX)
27 #include <gtk/gtk.h> 28 #include <gtk/gtk.h>
28 #endif 29 #endif
29 30
30 class TestSuite { 31 class TestSuite {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); 102 FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log"));
102 logging::InitLogging(log_filename.value().c_str(), 103 logging::InitLogging(log_filename.value().c_str(),
103 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, 104 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG,
104 logging::LOCK_LOG_FILE, 105 logging::LOCK_LOG_FILE,
105 logging::DELETE_OLD_LOG_FILE); 106 logging::DELETE_OLD_LOG_FILE);
106 // We want process and thread IDs because we may have multiple processes. 107 // We want process and thread IDs because we may have multiple processes.
107 // Note: temporarily enabled timestamps in an effort to catch bug 6361. 108 // Note: temporarily enabled timestamps in an effort to catch bug 6361.
108 logging::SetLogItems(true, true, true, true); 109 logging::SetLogItems(true, true, true, true);
109 110
110 #if defined(OS_WIN) 111 #if defined(OS_WIN)
112 // We don't want to use SystemMonitor power state monitoring in tests,
113 // so enable high resolution timer unconditionally.
114 base::Time::EnableHiResClockForTests();
Mike Belshe 2009/05/26 15:41:20 I think this comment will lose value over time bec
115
111 // In some cases, we do not want to see standard error dialogs. 116 // In some cases, we do not want to see standard error dialogs.
112 if (!IsDebuggerPresent() && 117 if (!IsDebuggerPresent() &&
113 !CommandLine::ForCurrentProcess()->HasSwitch(L"show-error-dialogs")) { 118 !CommandLine::ForCurrentProcess()->HasSwitch(L"show-error-dialogs")) {
114 SuppressErrorDialogs(); 119 SuppressErrorDialogs();
115 #if !defined(PURIFY) 120 #if !defined(PURIFY)
116 // When the code in this file moved around, bug 6436 resurfaced. 121 // When the code in this file moved around, bug 6436 resurfaced.
117 // As a hack workaround, just #ifdef out this code for Purify builds. 122 // As a hack workaround, just #ifdef out this code for Purify builds.
118 logging::SetLogAssertHandler(UnitTestAssertHandler); 123 logging::SetLogAssertHandler(UnitTestAssertHandler);
119 #endif 124 #endif // !defined(PURIFY)
120 } 125 }
121 #endif 126 #endif // defined(OS_WIN)
122 127
123 icu_util::Initialize(); 128 icu_util::Initialize();
124 } 129 }
125 130
126 virtual void Shutdown() { 131 virtual void Shutdown() {
127 } 132 }
128 133
129 // Make sure that we setup an AtExitManager so Singleton objects will be 134 // Make sure that we setup an AtExitManager so Singleton objects will be
130 // destroyed. 135 // destroyed.
131 base::AtExitManager at_exit_manager_; 136 base::AtExitManager at_exit_manager_;
132 }; 137 };
133 138
134 #endif // BASE_TEST_SUITE_H_ 139 #endif // BASE_TEST_SUITE_H_
OLDNEW
« no previous file with comments | « no previous file | base/time.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698