| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
| 10 #include "base/debug/stack_trace.h" | 10 #include "base/debug/stack_trace.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/i18n/icu_util.h" | 13 #include "base/i18n/icu_util.h" |
| 14 #include "base/json/json_reader.h" | 14 #include "base/json/json_reader.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/process/launch.h" | 18 #include "base/process/launch.h" |
| 19 #include "base/run_loop.h" | 19 #include "base/run_loop.h" |
| 20 #include "base/sys_info.h" | 20 #include "base/sys_info.h" |
| 21 #include "base/task_scheduler/task_scheduler.h" | 21 #include "base/task_scheduler/task_scheduler.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" | 22 #include "base/threading/thread_task_runner_handle.h" |
| 23 #include "base/values.h" | 23 #include "base/values.h" |
| 24 #include "chrome/app/mash/embedded_services.h" | 24 #include "chrome/app/mash/embedded_services.h" |
| 25 #include "chrome/test/base/chrome_test_launcher.h" | 25 #include "chrome/test/base/chrome_test_launcher.h" |
| 26 #include "chrome/test/base/chrome_test_suite.h" | 26 #include "chrome/test/base/chrome_test_suite.h" |
| 27 #include "chrome/test/base/mojo_test_connector.h" | 27 #include "chrome/test/base/mojo_test_connector.h" |
| 28 #include "content/public/app/content_main.h" | 28 #include "content/public/app/content_main.h" |
| 29 #include "content/public/common/service_manager_connection.h" | 29 #include "content/public/common/service_manager_connection.h" |
| 30 #include "content/public/common/service_names.mojom.h" |
| 30 #include "content/public/test/test_launcher.h" | 31 #include "content/public/test/test_launcher.h" |
| 31 #include "mash/session/public/interfaces/constants.mojom.h" | 32 #include "mash/session/public/interfaces/constants.mojom.h" |
| 32 #include "services/service_manager/public/cpp/connector.h" | 33 #include "services/service_manager/public/cpp/connector.h" |
| 33 #include "services/service_manager/public/cpp/service.h" | 34 #include "services/service_manager/public/cpp/service.h" |
| 34 #include "services/service_manager/public/cpp/service_context.h" | 35 #include "services/service_manager/public/cpp/service_context.h" |
| 35 #include "services/service_manager/public/cpp/service_runner.h" | 36 #include "services/service_manager/public/cpp/service_runner.h" |
| 36 #include "services/service_manager/public/cpp/standalone_service/standalone_serv
ice.h" | 37 #include "services/service_manager/public/cpp/standalone_service/standalone_serv
ice.h" |
| 37 #include "services/service_manager/runner/common/switches.h" | 38 #include "services/service_manager/runner/common/switches.h" |
| 38 #include "services/service_manager/runner/init.h" | 39 #include "services/service_manager/runner/init.h" |
| 39 #include "services/ui/common/switches.h" | 40 #include "services/ui/common/switches.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 run_loop.Run(); | 171 run_loop.Run(); |
| 171 } | 172 } |
| 172 | 173 |
| 173 } // namespace | 174 } // namespace |
| 174 | 175 |
| 175 bool RunMashBrowserTests(int argc, char** argv, int* exit_code) { | 176 bool RunMashBrowserTests(int argc, char** argv, int* exit_code) { |
| 176 base::CommandLine::Init(argc, argv); | 177 base::CommandLine::Init(argc, argv); |
| 177 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 178 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 178 if (!command_line->HasSwitch("run-in-mash") && | 179 if (!command_line->HasSwitch("run-in-mash") && |
| 179 !command_line->HasSwitch("run-in-mus")) { | 180 !command_line->HasSwitch("run-in-mus")) { |
| 181 // Currently launching content_package_services via the browser_tests binary |
| 182 // will lead to a nested test suite, trying to run all tests again. However |
| 183 // they will be in a strange mixed mode, of a local-Ash, but non-local Aura. |
| 184 // |
| 185 // This leads to continuous crashes in OzonePlatform. |
| 186 // |
| 187 // For now disable this launch until the requesting site can be identified. |
| 188 // |
| 189 // TODO(jonross): find an appropriate way to launch content_package_services |
| 190 // within the mash_browser_tests (crbug.com/738449) |
| 191 if (command_line->GetSwitchValueASCII("service-name") == |
| 192 content::mojom::kPackagedServicesServiceName) { |
| 193 return true; |
| 194 } |
| 180 return false; | 195 return false; |
| 181 } | 196 } |
| 182 | 197 |
| 183 if (command_line->HasSwitch(MojoTestConnector::kMashApp)) { | 198 if (command_line->HasSwitch(MojoTestConnector::kMashApp)) { |
| 184 #if defined(OS_LINUX) | 199 #if defined(OS_LINUX) |
| 185 base::AtExitManager exit_manager; | 200 base::AtExitManager exit_manager; |
| 186 #endif | 201 #endif |
| 187 base::i18n::InitializeICU(); | 202 base::i18n::InitializeICU(); |
| 188 | 203 |
| 189 #if !defined(OFFICIAL_BUILD) | 204 #if !defined(OFFICIAL_BUILD) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 210 if (command_line->HasSwitch(content::kSingleProcessTestsFlag) && | 225 if (command_line->HasSwitch(content::kSingleProcessTestsFlag) && |
| 211 !command_line->HasSwitch(service_manager::switches::kServicePipeToken)) { | 226 !command_line->HasSwitch(service_manager::switches::kServicePipeToken)) { |
| 212 service_manager_connection_factory = | 227 service_manager_connection_factory = |
| 213 base::Bind(&CreateServiceManagerConnection, &delegate); | 228 base::Bind(&CreateServiceManagerConnection, &delegate); |
| 214 content::ServiceManagerConnection::SetFactoryForTest( | 229 content::ServiceManagerConnection::SetFactoryForTest( |
| 215 &service_manager_connection_factory); | 230 &service_manager_connection_factory); |
| 216 } | 231 } |
| 217 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); | 232 *exit_code = LaunchChromeTests(default_jobs, &delegate, argc, argv); |
| 218 return true; | 233 return true; |
| 219 } | 234 } |
| OLD | NEW |