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