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

Side by Side Diff: base/test/test_suite.cc

Issue 26883002: Introduce base::TestSuite::DisableTests(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: now works on Android Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « base/test/test_suite.h ('k') | media/base/android/media_codec_bridge_unittest.cc » ('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) 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
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
146 size_t dash_pos = gtest_filter.find('-');
147 if (dash_pos == std::string::npos) // Not found.
148 gtest_filter += "-";
149
150 gtest_filter += ":";
151 gtest_filter += filter;
152 ::testing::FLAGS_gtest_filter = gtest_filter;
153 }
154
143 void TestSuite::ResetCommandLine() { 155 void TestSuite::ResetCommandLine() {
144 testing::TestEventListeners& listeners = 156 testing::TestEventListeners& listeners =
145 testing::UnitTest::GetInstance()->listeners(); 157 testing::UnitTest::GetInstance()->listeners();
146 listeners.Append(new TestClientInitializer); 158 listeners.Append(new TestClientInitializer);
147 } 159 }
148 160
149 #if !defined(OS_IOS) 161 #if !defined(OS_IOS)
150 void TestSuite::AddTestLauncherResultPrinter() { 162 void TestSuite::AddTestLauncherResultPrinter() {
151 // Only add the custom printer if requested. 163 // Only add the custom printer if requested.
152 if (!CommandLine::ForCurrentProcess()->HasSwitch( 164 if (!CommandLine::ForCurrentProcess()->HasSwitch(
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 ResetCommandLine(); 296 ResetCommandLine();
285 #if !defined(OS_IOS) 297 #if !defined(OS_IOS)
286 AddTestLauncherResultPrinter(); 298 AddTestLauncherResultPrinter();
287 #endif // !defined(OS_IOS) 299 #endif // !defined(OS_IOS)
288 300
289 TestTimeouts::Initialize(); 301 TestTimeouts::Initialize();
290 } 302 }
291 303
292 void TestSuite::Shutdown() { 304 void TestSuite::Shutdown() {
293 } 305 }
OLDNEW
« no previous file with comments | « base/test/test_suite.h ('k') | media/base/android/media_codec_bridge_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698