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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
133 bool TestSuite::IsMarkedMaybe(const testing::TestInfo& test) { | 133 bool TestSuite::IsMarkedMaybe(const testing::TestInfo& test) { |
134 return strncmp(test.name(), "MAYBE_", 6) == 0; | 134 return strncmp(test.name(), "MAYBE_", 6) == 0; |
135 } | 135 } |
136 | 136 |
137 void TestSuite::CatchMaybeTests() { | 137 void TestSuite::CatchMaybeTests() { |
138 testing::TestEventListeners& listeners = | 138 testing::TestEventListeners& listeners = |
139 testing::UnitTest::GetInstance()->listeners(); | 139 testing::UnitTest::GetInstance()->listeners(); |
140 listeners.Append(new MaybeTestDisabler); | 140 listeners.Append(new MaybeTestDisabler); |
141 } | 141 } |
142 | 142 |
143 void TestSuite::DisableTests(const std::string& filter) { | |
144 std::string gtest_filter = ::testing::FLAGS_gtest_filter; | |
145 gtest_filter += ":-"; | |
146 gtest_filter += filter; | |
147 ::testing::FLAGS_gtest_filter = gtest_filter; | |
Paweł Hajdan Jr.
2013/10/10 18:10:42
Please don't do that. By the time you change it it
| |
148 } | |
149 | |
143 void TestSuite::ResetCommandLine() { | 150 void TestSuite::ResetCommandLine() { |
144 testing::TestEventListeners& listeners = | 151 testing::TestEventListeners& listeners = |
145 testing::UnitTest::GetInstance()->listeners(); | 152 testing::UnitTest::GetInstance()->listeners(); |
146 listeners.Append(new TestClientInitializer); | 153 listeners.Append(new TestClientInitializer); |
147 } | 154 } |
148 | 155 |
149 #if !defined(OS_IOS) | 156 #if !defined(OS_IOS) |
150 void TestSuite::AddTestLauncherResultPrinter() { | 157 void TestSuite::AddTestLauncherResultPrinter() { |
151 // Only add the custom printer if requested. | 158 // Only add the custom printer if requested. |
152 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 159 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 ResetCommandLine(); | 291 ResetCommandLine(); |
285 #if !defined(OS_IOS) | 292 #if !defined(OS_IOS) |
286 AddTestLauncherResultPrinter(); | 293 AddTestLauncherResultPrinter(); |
287 #endif // !defined(OS_IOS) | 294 #endif // !defined(OS_IOS) |
288 | 295 |
289 TestTimeouts::Initialize(); | 296 TestTimeouts::Initialize(); |
290 } | 297 } |
291 | 298 |
292 void TestSuite::Shutdown() { | 299 void TestSuite::Shutdown() { |
293 } | 300 } |
OLD | NEW |