Index: base/test/test_suite.cc |
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc |
index ad5d9245bfe86ed11ee82fce7791582dbfc6f513..5777c5da879ece984adbbaf58540f02456c3aa10 100644 |
--- a/base/test/test_suite.cc |
+++ b/base/test/test_suite.cc |
@@ -90,12 +90,22 @@ |
} // namespace base |
TestSuite::TestSuite(int argc, char** argv) : initialized_command_line_(false) { |
- PreInitialize(argc, argv, true); |
-} |
+ PreInitialize(true); |
+ InitializeFromCommandLine(argc, argv); |
+} |
+ |
+#if defined(OS_WIN) |
+TestSuite::TestSuite(int argc, wchar_t** argv) |
+ : initialized_command_line_(false) { |
+ PreInitialize(true); |
+ InitializeFromCommandLine(argc, argv); |
+} |
+#endif // defined(OS_WIN) |
TestSuite::TestSuite(int argc, char** argv, bool create_at_exit_manager) |
: initialized_command_line_(false) { |
- PreInitialize(argc, argv, create_at_exit_manager); |
+ PreInitialize(create_at_exit_manager); |
+ InitializeFromCommandLine(argc, argv); |
} |
TestSuite::~TestSuite() { |
@@ -103,16 +113,31 @@ |
CommandLine::Reset(); |
} |
-void TestSuite::PreInitialize(int argc, char** argv, |
- bool create_at_exit_manager) { |
-#if defined(OS_WIN) |
- testing::GTEST_FLAG(catch_exceptions) = false; |
- base::TimeTicks::SetNowIsHighResNowIfSupported(); |
-#endif |
- base::EnableTerminationOnHeapCorruption(); |
+void TestSuite::InitializeFromCommandLine(int argc, char** argv) { |
initialized_command_line_ = CommandLine::Init(argc, argv); |
testing::InitGoogleTest(&argc, argv); |
testing::InitGoogleMock(&argc, argv); |
+ |
+#if defined(OS_IOS) |
+ InitIOSRunHook(this, argc, argv); |
+#endif |
+} |
+ |
+#if defined(OS_WIN) |
+void TestSuite::InitializeFromCommandLine(int argc, wchar_t** argv) { |
+ // Windows CommandLine::Init ignores argv anyway. |
+ initialized_command_line_ = CommandLine::Init(argc, NULL); |
+ testing::InitGoogleTest(&argc, argv); |
+ testing::InitGoogleMock(&argc, argv); |
+} |
+#endif // defined(OS_WIN) |
+ |
+void TestSuite::PreInitialize(bool create_at_exit_manager) { |
+#if defined(OS_WIN) |
+ testing::GTEST_FLAG(catch_exceptions) = false; |
+ base::TimeTicks::SetNowIsHighResNowIfSupported(); |
+#endif |
+ base::EnableTerminationOnHeapCorruption(); |
#if defined(OS_LINUX) && defined(USE_AURA) |
// When calling native char conversion functions (e.g wrctomb) we need to |
// have the locale set. In the absence of such a call the "C" locale is the |
@@ -125,10 +150,6 @@ |
#if !defined(OS_ANDROID) |
if (create_at_exit_manager) |
at_exit_manager_.reset(new base::AtExitManager); |
-#endif |
- |
-#if defined(OS_IOS) |
- InitIOSRunHook(this, argc, argv); |
#endif |
// Don't add additional code to this function. Instead add it to |