| 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 "mojo/application/public/cpp/application_connection.h" | 7 #include "mojo/application/public/cpp/application_connection.h" |
| 8 #include "mojo/application/public/cpp/application_delegate.h" | 8 #include "mojo/application/public/cpp/application_delegate.h" |
| 9 #include "mojo/application/public/cpp/application_impl.h" | 9 #include "mojo/application/public/cpp/application_impl.h" |
| 10 #include "mojo/converters/network/network_type_converters.h" | 10 #include "mojo/converters/network/network_type_converters.h" |
| 11 #include "mojo/runner/child/test_native_main.h" | 11 #include "mojo/runner/child/test_native_main.h" |
| 12 #include "mojo/runner/init.h" | 12 #include "mojo/runner/init.h" |
| 13 #include "mojo/shell/application_manager_apptests.mojom.h" | 13 #include "mojo/shell/application_manager_apptests.mojom.h" |
| 14 | 14 |
| 15 using mojo::shell::test::mojom::CreateInstanceForHandleTestPtr; | 15 using mojo::shell::test::mojom::CreateInstanceForHandleTestPtr; |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class TargetApplicationDelegate : public mojo::ApplicationDelegate { | 19 class TargetApplicationDelegate : public mojo::ApplicationDelegate { |
| 20 public: | 20 public: |
| 21 TargetApplicationDelegate() {} | 21 TargetApplicationDelegate() {} |
| 22 ~TargetApplicationDelegate() override {} | 22 ~TargetApplicationDelegate() override {} |
| 23 | 23 |
| 24 private: | 24 private: |
| 25 // mojo::ApplicationDelegate: | 25 // mojo::ApplicationDelegate: |
| 26 void Initialize(mojo::ApplicationImpl* app) override { | 26 void Initialize(mojo::ApplicationImpl* app) override { |
| 27 CreateInstanceForHandleTestPtr service; | 27 CreateInstanceForHandleTestPtr service; |
| 28 app->ConnectToService( | 28 mojo::ApplicationImpl::ConnectParams params( |
| 29 mojo::URLRequest::From(std::string("mojo:mojo_shell_apptests")), | 29 std::string("mojo:mojo_shell_apptests")); |
| 30 &service); | 30 app->ConnectToService(¶ms, &service); |
| 31 service->Ping("From Target"); | 31 service->Ping("From Target"); |
| 32 } | 32 } |
| 33 bool ConfigureIncomingConnection( | 33 bool ConfigureIncomingConnection( |
| 34 mojo::ApplicationConnection* connection) override { | 34 mojo::ApplicationConnection* connection) override { |
| 35 return true; | 35 return true; |
| 36 } | 36 } |
| 37 | 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(TargetApplicationDelegate); | 38 DISALLOW_COPY_AND_ASSIGN(TargetApplicationDelegate); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 } // namespace | 41 } // namespace |
| 42 | 42 |
| 43 int main(int argc, char** argv) { | 43 int main(int argc, char** argv) { |
| 44 base::AtExitManager at_exit; | 44 base::AtExitManager at_exit; |
| 45 base::CommandLine::Init(argc, argv); | 45 base::CommandLine::Init(argc, argv); |
| 46 | 46 |
| 47 mojo::runner::InitializeLogging(); | 47 mojo::runner::InitializeLogging(); |
| 48 | 48 |
| 49 TargetApplicationDelegate delegate; | 49 TargetApplicationDelegate delegate; |
| 50 return mojo::runner::TestNativeMain(&delegate); | 50 return mojo::runner::TestNativeMain(&delegate); |
| 51 } | 51 } |
| OLD | NEW |