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

Unified Diff: base/test/test_suite.cc

Issue 8561031: Replace ScopedCommandLineOverride with TestSuite listener. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify per Pawel's suggestions. Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_model_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/test/test_suite.cc
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index c257b141819851ddfa0987e3ce84bc26bf04478b..8f2affbcbac9636b21a3fa10a601bd4024a60af2 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -47,6 +47,26 @@ class MaybeTestDisabler : public testing::EmptyTestEventListener {
}
};
+class TestClientInitializer : public testing::EmptyTestEventListener {
+ public:
+ TestClientInitializer()
+ : old_command_line_(CommandLine::NO_PROGRAM) {
asargent_no_longer_on_chrome 2011/11/21 19:19:50 I guess it doesn't really matter since you set it
+ }
+
+ virtual void OnTestStart(const testing::TestInfo& test_info) OVERRIDE {
+ old_command_line_ = *CommandLine::ForCurrentProcess();
+ }
+
+ virtual void OnTestEnd(const testing::TestInfo& test_info) OVERRIDE {
+ *CommandLine::ForCurrentProcess() = old_command_line_;
+ }
+
+ private:
+ CommandLine old_command_line_;
+
+ DISALLOW_COPY_AND_ASSIGN(TestClientInitializer);
+};
+
} // namespace
const char TestSuite::kStrictFailureHandling[] = "strict_failure_handling";
@@ -230,6 +250,10 @@ void TestSuite::Initialize() {
CatchMaybeTests();
+ testing::TestEventListeners& listeners =
Paweł Hajdan Jr. 2011/11/21 19:59:32 nit: It's slightly inconsistent to add the MAYBE t
+ testing::UnitTest::GetInstance()->listeners();
+ listeners.Append(new TestClientInitializer);
+
TestTimeouts::Initialize();
}
« no previous file with comments | « no previous file | chrome/browser/bookmarks/bookmark_model_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698