| 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 #ifndef CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_ | 5 #ifndef CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_ |
| 6 #define CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_ | 6 #define CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/process/process_handle.h" | 11 #include "base/process/process_handle.h" |
| 12 #include "base/test/launcher/test_launcher.h" | 12 #include "base/test/launcher/test_launcher.h" |
| 13 #include "services/service_manager/background/background_service_manager.h" | 13 #include "services/service_manager/background/background_service_manager.h" |
| 14 #include "services/service_manager/public/interfaces/service.mojom.h" | 14 #include "services/service_manager/public/interfaces/service.mojom.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class CommandLine; | 17 class CommandLine; |
| 18 class Thread; |
| 19 class Value; |
| 20 } |
| 21 |
| 22 namespace mojo { |
| 23 namespace edk { |
| 24 class ScopedIPCSupport; |
| 25 } |
| 18 } | 26 } |
| 19 | 27 |
| 20 namespace content { | 28 namespace content { |
| 21 class TestState; | 29 class TestState; |
| 22 } | 30 } |
| 23 | 31 |
| 24 // MojoTestConnector in responsible for providing the necessary wiring for | 32 // MojoTestConnector is responsible for providing the necessary wiring for |
| 25 // test processes to get a mojo channel passed to them. To use this class | 33 // test processes to get a mojo channel passed to them. To use this class |
| 26 // call PrepareForTest() prior to launching each test. It is expected | 34 // call PrepareForTest() prior to launching each test. It is expected |
| 27 // PrepareForTest() is called from content::TestLauncherDelegate::PreRunTest(). | 35 // PrepareForTest() is called from content::TestLauncherDelegate::PreRunTest(). |
| 28 class MojoTestConnector { | 36 class MojoTestConnector { |
| 29 public: | 37 public: |
| 30 // Switch added to command line of each test. | 38 // Switch added to command line of each test. |
| 31 static const char kTestSwitch[]; | 39 static const char kTestSwitch[]; |
| 32 | 40 |
| 33 // Command line switch added to all apps that are expected to be provided by | 41 // Command line switch added to all apps that are expected to be provided by |
| 34 // browser_tests. | 42 // browser_tests. |
| 35 static const char kMashApp[]; | 43 static const char kMashApp[]; |
| 36 | 44 |
| 37 MojoTestConnector(); | 45 explicit MojoTestConnector(std::unique_ptr<base::Value> catalog_contents); |
| 38 ~MojoTestConnector(); | 46 ~MojoTestConnector(); |
| 39 | 47 |
| 40 // Initializes the background thread the ServiceManager runs on. | 48 // Initializes the background thread the ServiceManager runs on. |
| 41 service_manager::mojom::ServiceRequest Init(); | 49 service_manager::mojom::ServiceRequest Init(); |
| 42 | 50 |
| 43 std::unique_ptr<content::TestState> PrepareForTest( | 51 std::unique_ptr<content::TestState> PrepareForTest( |
| 44 base::CommandLine* command_line, | 52 base::CommandLine* command_line, |
| 45 base::TestLauncher::LaunchOptions* test_launch_options); | 53 base::TestLauncher::LaunchOptions* test_launch_options); |
| 46 | 54 |
| 47 private: | 55 private: |
| 48 class ServiceProcessLauncherDelegateImpl; | 56 class ServiceProcessLauncherDelegateImpl; |
| 49 | 57 |
| 50 std::unique_ptr<ServiceProcessLauncherDelegateImpl> | 58 std::unique_ptr<ServiceProcessLauncherDelegateImpl> |
| 51 service_process_launcher_delegate_; | 59 service_process_launcher_delegate_; |
| 60 service_manager::BackgroundServiceManager background_service_manager_; |
| 52 | 61 |
| 53 service_manager::BackgroundServiceManager background_service_manager_; | 62 std::unique_ptr<base::Thread> ipc_thread_; |
| 63 std::unique_ptr<mojo::edk::ScopedIPCSupport> ipc_support_; |
| 54 | 64 |
| 55 DISALLOW_COPY_AND_ASSIGN(MojoTestConnector); | 65 DISALLOW_COPY_AND_ASSIGN(MojoTestConnector); |
| 56 }; | 66 }; |
| 57 | 67 |
| 58 #endif // CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_ | 68 #endif // CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_ |
| OLD | NEW |