| 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/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 command_line->AppendSwitchASCII("vmodule", | 220 command_line->AppendSwitchASCII("vmodule", |
| 221 "*/remoting/*=" + verbosity_level); | 221 "*/remoting/*=" + verbosity_level); |
| 222 logging::LoggingSettings logging_settings; | 222 logging::LoggingSettings logging_settings; |
| 223 logging::InitLogging(logging_settings); | 223 logging::InitLogging(logging_settings); |
| 224 } | 224 } |
| 225 | 225 |
| 226 // Create and register our global test data object. It will handle | 226 // Create and register our global test data object. It will handle |
| 227 // retrieving an access token for the user and spinning up VMs. | 227 // retrieving an access token for the user and spinning up VMs. |
| 228 // The GTest framework will own the lifetime of this object once | 228 // The GTest framework will own the lifetime of this object once |
| 229 // it is registered below. | 229 // it is registered below. |
| 230 scoped_ptr<remoting::test::AppRemotingTestDriverEnvironment> shared_data( | 230 std::unique_ptr<remoting::test::AppRemotingTestDriverEnvironment> shared_data( |
| 231 remoting::test::CreateAppRemotingTestDriverEnvironment(options)); | 231 remoting::test::CreateAppRemotingTestDriverEnvironment(options)); |
| 232 | 232 |
| 233 if (!shared_data->Initialize(auth_code)) { | 233 if (!shared_data->Initialize(auth_code)) { |
| 234 // If we failed to initialize our shared data object, then bail. | 234 // If we failed to initialize our shared data object, then bail. |
| 235 return -1; | 235 return -1; |
| 236 } | 236 } |
| 237 | 237 |
| 238 if (command_line->HasSwitch(switches::kShowHostAvailabilitySwitchName)) { | 238 if (command_line->HasSwitch(switches::kShowHostAvailabilitySwitchName)) { |
| 239 // When this flag is specified, we will retrieve connection information | 239 // When this flag is specified, we will retrieve connection information |
| 240 // for all known applications and report the status. Tests can be skipped | 240 // for all known applications and report the status. Tests can be skipped |
| 241 // using a gtest_filter flag. | 241 // using a gtest_filter flag. |
| 242 shared_data->ShowHostAvailability(); | 242 shared_data->ShowHostAvailability(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 // Since we've successfully set up our shared_data object, we'll assign the | 245 // Since we've successfully set up our shared_data object, we'll assign the |
| 246 // value to our global* and transfer ownership to the framework. | 246 // value to our global* and transfer ownership to the framework. |
| 247 remoting::test::AppRemotingSharedData = shared_data.release(); | 247 remoting::test::AppRemotingSharedData = shared_data.release(); |
| 248 testing::AddGlobalTestEnvironment(remoting::test::AppRemotingSharedData); | 248 testing::AddGlobalTestEnvironment(remoting::test::AppRemotingSharedData); |
| 249 | 249 |
| 250 // Because many tests may access the same remoting host(s), we need to run | 250 // Because many tests may access the same remoting host(s), we need to run |
| 251 // the tests sequentially so they do not interfere with each other. | 251 // the tests sequentially so they do not interfere with each other. |
| 252 return base::LaunchUnitTestsSerially( | 252 return base::LaunchUnitTestsSerially( |
| 253 argc, argv, | 253 argc, argv, |
| 254 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); | 254 base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite))); |
| 255 } | 255 } |
| OLD | NEW |