| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 command_line->AppendSwitch(switches::kSingleProcessTestsSwitchName); | 157 command_line->AppendSwitch(switches::kSingleProcessTestsSwitchName); |
| 158 | 158 |
| 159 // If the user passed in the help flag, then show the help info for this tool | 159 // If the user passed in the help flag, then show the help info for this tool |
| 160 // and 'run' the tests which will print the gtest specific help and then exit. | 160 // and 'run' the tests which will print the gtest specific help and then exit. |
| 161 // NOTE: We do this check after updating the switches as otherwise the gtest | 161 // NOTE: We do this check after updating the switches as otherwise the gtest |
| 162 // help is written in parallel with our text and can appear interleaved. | 162 // help is written in parallel with our text and can appear interleaved. |
| 163 if (command_line->HasSwitch(switches::kHelpSwitchName)) { | 163 if (command_line->HasSwitch(switches::kHelpSwitchName)) { |
| 164 PrintUsage(); | 164 PrintUsage(); |
| 165 PrintJsonFileInfo(); | 165 PrintJsonFileInfo(); |
| 166 PrintAuthCodeInfo(); | 166 PrintAuthCodeInfo(); |
| 167 #if defined(OS_IOS) |
| 168 return base::LaunchUnitTests( |
| 169 argc, argv, |
| 170 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
| 171 #else |
| 167 return base::LaunchUnitTestsSerially( | 172 return base::LaunchUnitTestsSerially( |
| 168 argc, argv, | 173 argc, argv, |
| 169 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 174 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
| 175 #endif |
| 170 } | 176 } |
| 171 | 177 |
| 172 // Update the logging verbosity level if user specified one. | 178 // Update the logging verbosity level if user specified one. |
| 173 std::string verbosity_level( | 179 std::string verbosity_level( |
| 174 command_line->GetSwitchValueASCII(switches::kLoggingLevelSwitchName)); | 180 command_line->GetSwitchValueASCII(switches::kLoggingLevelSwitchName)); |
| 175 if (!verbosity_level.empty()) { | 181 if (!verbosity_level.empty()) { |
| 176 // Turn on logging for the test_driver and remoting components. | 182 // Turn on logging for the test_driver and remoting components. |
| 177 // This switch is parsed during logging::InitLogging. | 183 // This switch is parsed during logging::InitLogging. |
| 178 command_line->AppendSwitchASCII("vmodule", | 184 command_line->AppendSwitchASCII("vmodule", |
| 179 "*/remoting/*=" + verbosity_level); | 185 "*/remoting/*=" + verbosity_level); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 return -1; | 241 return -1; |
| 236 } | 242 } |
| 237 | 243 |
| 238 // Since we've successfully set up our shared_data object, we'll assign the | 244 // Since we've successfully set up our shared_data object, we'll assign the |
| 239 // value to our global* and transfer ownership to the framework. | 245 // value to our global* and transfer ownership to the framework. |
| 240 remoting::test::g_chromoting_shared_data = shared_data.release(); | 246 remoting::test::g_chromoting_shared_data = shared_data.release(); |
| 241 testing::AddGlobalTestEnvironment(remoting::test::g_chromoting_shared_data); | 247 testing::AddGlobalTestEnvironment(remoting::test::g_chromoting_shared_data); |
| 242 | 248 |
| 243 // Running the tests serially will avoid clients from connecting to the same | 249 // Running the tests serially will avoid clients from connecting to the same |
| 244 // host. | 250 // host. |
| 251 #if defined(OS_IOS) |
| 252 return base::LaunchUnitTests( |
| 253 argc, argv, |
| 254 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
| 255 #else |
| 245 return base::LaunchUnitTestsSerially( | 256 return base::LaunchUnitTestsSerially( |
| 246 argc, argv, | 257 argc, argv, |
| 247 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 258 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
| 259 #endif |
| 248 } | 260 } |
| OLD | NEW |