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/shell/background/background_shell.h" | 13 #include "services/shell/background/background_shell.h" |
14 #include "services/shell/public/interfaces/shell_client.mojom.h" | 14 #include "services/shell/public/interfaces/service.mojom.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class CommandLine; | 17 class CommandLine; |
18 } | 18 } |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class TestState; | 21 class TestState; |
22 } | 22 } |
23 | 23 |
24 namespace mojo { | 24 namespace mojo { |
25 class ShellClient; | 25 class Service; |
26 class ShellConnection; | 26 class ShellConnection; |
27 } | 27 } |
28 | 28 |
29 // MojoTestConnector in responsible for providing the necessary wiring for | 29 // MojoTestConnector in responsible for providing the necessary wiring for |
30 // test processes to get a mojo channel passed to them. To use this class | 30 // test processes to get a mojo channel passed to them. To use this class |
31 // call PrepareForTest() prior to launching each test. It is expected | 31 // call PrepareForTest() prior to launching each test. It is expected |
32 // PrepareForTest() is called from content::TestLauncherDelegate::PreRunTest(). | 32 // PrepareForTest() is called from content::TestLauncherDelegate::PreRunTest(). |
33 class MojoTestConnector { | 33 class MojoTestConnector { |
34 public: | 34 public: |
35 // Switch added to command line of each test. | 35 // Switch added to command line of each test. |
36 static const char kTestSwitch[]; | 36 static const char kTestSwitch[]; |
37 | 37 |
38 MojoTestConnector(); | 38 MojoTestConnector(); |
39 ~MojoTestConnector(); | 39 ~MojoTestConnector(); |
40 | 40 |
41 // Initializes the background thread the Shell runs on. | 41 // Initializes the background thread the Shell runs on. |
42 shell::mojom::ShellClientRequest Init(); | 42 shell::mojom::ServiceRequest Init(); |
43 | 43 |
44 std::unique_ptr<content::TestState> PrepareForTest( | 44 std::unique_ptr<content::TestState> PrepareForTest( |
45 base::CommandLine* command_line, | 45 base::CommandLine* command_line, |
46 base::TestLauncher::LaunchOptions* test_launch_options); | 46 base::TestLauncher::LaunchOptions* test_launch_options); |
47 | 47 |
48 private: | 48 private: |
49 shell::BackgroundShell background_shell_; | 49 shell::BackgroundShell background_shell_; |
50 | 50 |
51 DISALLOW_COPY_AND_ASSIGN(MojoTestConnector); | 51 DISALLOW_COPY_AND_ASSIGN(MojoTestConnector); |
52 }; | 52 }; |
53 | 53 |
54 #endif // CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_ | 54 #endif // CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_ |
OLD | NEW |