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/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "mojo/public/cpp/bindings/binding_set.h" | 8 #include "mojo/public/cpp/bindings/binding_set.h" |
9 #include "services/shell/public/cpp/connection.h" | 9 #include "services/shell/public/cpp/connection.h" |
10 #include "services/shell/public/cpp/connector.h" | 10 #include "services/shell/public/cpp/connector.h" |
| 11 #include "services/shell/public/cpp/interface_factory.h" |
| 12 #include "services/shell/public/cpp/interface_registry.h" |
11 #include "services/shell/public/cpp/service.h" | 13 #include "services/shell/public/cpp/service.h" |
12 #include "services/shell/runner/child/test_native_main.h" | 14 #include "services/shell/runner/child/test_native_main.h" |
13 #include "services/shell/runner/init.h" | 15 #include "services/shell/runner/init.h" |
14 #include "services/shell/tests/connect/connect_test.mojom.h" | 16 #include "services/shell/tests/connect/connect_test.mojom.h" |
15 | 17 |
16 using shell::test::mojom::ConnectTestService; | 18 using shell::test::mojom::ConnectTestService; |
17 using shell::test::mojom::ConnectTestServiceRequest; | 19 using shell::test::mojom::ConnectTestServiceRequest; |
18 | 20 |
19 namespace { | 21 namespace { |
20 | 22 |
21 class Target : public shell::Service, | 23 class Target : public shell::Service, |
22 public shell::InterfaceFactory<ConnectTestService>, | 24 public shell::InterfaceFactory<ConnectTestService>, |
23 public ConnectTestService { | 25 public ConnectTestService { |
24 public: | 26 public: |
25 Target() {} | 27 Target() {} |
26 ~Target() override {} | 28 ~Target() override {} |
27 | 29 |
28 private: | 30 private: |
29 // shell::Service: | 31 // shell::Service: |
30 void OnStart(const shell::Identity& identity) override { | 32 void OnStart(const shell::Identity& identity) override { |
31 identity_ = identity; | 33 identity_ = identity; |
32 } | 34 } |
33 bool OnConnect(shell::Connection* connection) override { | 35 bool OnConnect(const shell::Identity& remote_identity, |
34 connection->AddInterface<ConnectTestService>(this); | 36 shell::InterfaceRegistry* registry) override { |
| 37 registry->AddInterface<ConnectTestService>(this); |
35 return true; | 38 return true; |
36 } | 39 } |
37 | 40 |
38 // shell::InterfaceFactory<ConnectTestService>: | 41 // shell::InterfaceFactory<ConnectTestService>: |
39 void Create(const shell::Identity& remote_identity, | 42 void Create(const shell::Identity& remote_identity, |
40 ConnectTestServiceRequest request) override { | 43 ConnectTestServiceRequest request) override { |
41 bindings_.AddBinding(this, std::move(request)); | 44 bindings_.AddBinding(this, std::move(request)); |
42 } | 45 } |
43 | 46 |
44 // ConnectTestService: | 47 // ConnectTestService: |
(...skipping 14 matching lines...) Expand all Loading... |
59 | 62 |
60 int main(int argc, char** argv) { | 63 int main(int argc, char** argv) { |
61 base::AtExitManager at_exit; | 64 base::AtExitManager at_exit; |
62 base::CommandLine::Init(argc, argv); | 65 base::CommandLine::Init(argc, argv); |
63 | 66 |
64 shell::InitializeLogging(); | 67 shell::InitializeLogging(); |
65 | 68 |
66 Target target; | 69 Target target; |
67 return shell::TestNativeMain(&target); | 70 return shell::TestNativeMain(&target); |
68 } | 71 } |
OLD | NEW |