| 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 #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 "base/process/process.h" | 8 #include "base/process/process.h" |
| 9 #include "mojo/public/cpp/bindings/binding_set.h" | 9 #include "mojo/public/cpp/bindings/binding_set.h" |
| 10 #include "mojo/shell/public/cpp/connection.h" | 10 #include "mojo/shell/public/cpp/connection.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 private: | 30 private: |
| 31 // mojo::ShellClient: | 31 // mojo::ShellClient: |
| 32 void Initialize(mojo::Connector* connector, const mojo::Identity& identity, | 32 void Initialize(mojo::Connector* connector, const mojo::Identity& identity, |
| 33 uint32_t id) override { | 33 uint32_t id) override { |
| 34 connector_ = connector; | 34 connector_ = connector; |
| 35 } | 35 } |
| 36 bool AcceptConnection(mojo::Connection* connection) override { | 36 bool AcceptConnection(mojo::Connection* connection) override { |
| 37 connection->AddInterface<ClientProcessTest>(this); | 37 connection->AddInterface<ClientProcessTest>(this); |
| 38 return true; | 38 return true; |
| 39 } | 39 } |
| 40 void ShellConnectionLost() override { |
| 41 // TODO: This should exit cleanly. |
| 42 _exit(1); |
| 43 } |
| 40 | 44 |
| 41 // mojo::InterfaceFactory<ConnectTestService>: | 45 // mojo::InterfaceFactory<ConnectTestService>: |
| 42 void Create(mojo::Connection* connection, | 46 void Create(mojo::Connection* connection, |
| 43 ClientProcessTestRequest request) override { | 47 ClientProcessTestRequest request) override { |
| 44 bindings_.AddBinding(this, std::move(request)); | 48 bindings_.AddBinding(this, std::move(request)); |
| 45 } | 49 } |
| 46 | 50 |
| 47 // test::mojom::ClientProcessTest: | 51 // test::mojom::ClientProcessTest: |
| 48 void LaunchAndConnectToProcess( | 52 void LaunchAndConnectToProcess( |
| 49 const LaunchAndConnectToProcessCallback& callback) override { | 53 const LaunchAndConnectToProcessCallback& callback) override { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 74 | 78 |
| 75 int main(int argc, char** argv) { | 79 int main(int argc, char** argv) { |
| 76 base::AtExitManager at_exit; | 80 base::AtExitManager at_exit; |
| 77 base::CommandLine::Init(argc, argv); | 81 base::CommandLine::Init(argc, argv); |
| 78 | 82 |
| 79 mojo::shell::InitializeLogging(); | 83 mojo::shell::InitializeLogging(); |
| 80 | 84 |
| 81 Driver driver; | 85 Driver driver; |
| 82 return mojo::shell::TestNativeMain(&driver); | 86 return mojo::shell::TestNativeMain(&driver); |
| 83 } | 87 } |
| OLD | NEW |