| 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 } | |
| 44 | 40 |
| 45 // mojo::InterfaceFactory<ConnectTestService>: | 41 // mojo::InterfaceFactory<ConnectTestService>: |
| 46 void Create(mojo::Connection* connection, | 42 void Create(mojo::Connection* connection, |
| 47 ClientProcessTestRequest request) override { | 43 ClientProcessTestRequest request) override { |
| 48 bindings_.AddBinding(this, std::move(request)); | 44 bindings_.AddBinding(this, std::move(request)); |
| 49 } | 45 } |
| 50 | 46 |
| 51 // test::mojom::ClientProcessTest: | 47 // test::mojom::ClientProcessTest: |
| 52 void LaunchAndConnectToProcess( | 48 void LaunchAndConnectToProcess( |
| 53 const LaunchAndConnectToProcessCallback& callback) override { | 49 const LaunchAndConnectToProcessCallback& callback) override { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 78 | 74 |
| 79 int main(int argc, char** argv) { | 75 int main(int argc, char** argv) { |
| 80 base::AtExitManager at_exit; | 76 base::AtExitManager at_exit; |
| 81 base::CommandLine::Init(argc, argv); | 77 base::CommandLine::Init(argc, argv); |
| 82 | 78 |
| 83 mojo::shell::InitializeLogging(); | 79 mojo::shell::InitializeLogging(); |
| 84 | 80 |
| 85 Driver driver; | 81 Driver driver; |
| 86 return mojo::shell::TestNativeMain(&driver); | 82 return mojo::shell::TestNativeMain(&driver); |
| 87 } | 83 } |
| OLD | NEW |