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(); |
} |