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