| 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/service.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::Service, | 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::Service: | 29 // shell::Service: |
| 30 void OnStart(shell::Connector* connector, | 30 void OnStart(const shell::Identity& identity) override { |
| 31 const shell::Identity& identity, | |
| 32 uint32_t id) override { | |
| 33 identity_ = identity; | 31 identity_ = identity; |
| 34 } | 32 } |
| 35 bool OnConnect(shell::Connection* connection) override { | 33 bool OnConnect(shell::Connection* connection) override { |
| 36 connection->AddInterface<ConnectTestService>(this); | 34 connection->AddInterface<ConnectTestService>(this); |
| 37 return true; | 35 return true; |
| 38 } | 36 } |
| 39 | 37 |
| 40 // shell::InterfaceFactory<ConnectTestService>: | 38 // shell::InterfaceFactory<ConnectTestService>: |
| 41 void Create(const shell::Identity& remote_identity, | 39 void Create(const shell::Identity& remote_identity, |
| 42 ConnectTestServiceRequest request) override { | 40 ConnectTestServiceRequest request) override { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 61 | 59 |
| 62 int main(int argc, char** argv) { | 60 int main(int argc, char** argv) { |
| 63 base::AtExitManager at_exit; | 61 base::AtExitManager at_exit; |
| 64 base::CommandLine::Init(argc, argv); | 62 base::CommandLine::Init(argc, argv); |
| 65 | 63 |
| 66 shell::InitializeLogging(); | 64 shell::InitializeLogging(); |
| 67 | 65 |
| 68 Target target; | 66 Target target; |
| 69 return shell::TestNativeMain(&target); | 67 return shell::TestNativeMain(&target); |
| 70 } | 68 } |
| OLD | NEW |