| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "mojo/examples/apptest/example_client_application.h" |
| 5 #include "mojo/examples/apptest/example_client_impl.h" | 6 #include "mojo/examples/apptest/example_client_impl.h" |
| 6 #include "mojo/examples/apptest/example_service.mojom.h" | 7 #include "mojo/examples/apptest/example_service.mojom.h" |
| 7 #include "mojo/public/cpp/application/application_delegate.h" | 8 #include "mojo/public/cpp/application/application_delegate.h" |
| 8 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
| 9 #include "mojo/public/cpp/bindings/callback.h" | 10 #include "mojo/public/cpp/bindings/callback.h" |
| 10 #include "mojo/public/cpp/environment/environment.h" | 11 #include "mojo/public/cpp/environment/environment.h" |
| 11 #include "mojo/public/cpp/system/macros.h" | 12 #include "mojo/public/cpp/system/macros.h" |
| 13 #include "mojo/public/cpp/system/main.h" |
| 12 #include "mojo/public/cpp/utility/run_loop.h" | 14 #include "mojo/public/cpp/utility/run_loop.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 16 |
| 15 namespace { | 17 namespace { |
| 16 | 18 |
| 17 // TODO(msw): Remove this once we can get ApplicationImpl from TLS. | 19 // TODO(msw): Remove this once we can get ApplicationImpl from TLS. |
| 18 mojo::ApplicationImpl* g_application_impl_hack = NULL; | 20 mojo::ApplicationImpl* g_application_impl_hack = NULL; |
| 19 | 21 |
| 20 } // namespace | 22 } // namespace |
| 21 | 23 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 bool was_run = false; | 66 bool was_run = false; |
| 65 example_service_->RunCallback(SetAndQuit<bool>(&was_run, true)); | 67 example_service_->RunCallback(SetAndQuit<bool>(&was_run, true)); |
| 66 RunLoop::current()->Run(); | 68 RunLoop::current()->Run(); |
| 67 EXPECT_TRUE(was_run); | 69 EXPECT_TRUE(was_run); |
| 68 } | 70 } |
| 69 | 71 |
| 70 } // namespace | 72 } // namespace |
| 71 | 73 |
| 72 } // namespace mojo | 74 } // namespace mojo |
| 73 | 75 |
| 74 extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain( | 76 MojoResult MojoMain(MojoHandle shell_handle) { |
| 75 MojoHandle shell_handle) { | |
| 76 mojo::Environment env; | 77 mojo::Environment env; |
| 77 mojo::RunLoop loop; | 78 mojo::RunLoop loop; |
| 78 | 79 |
| 79 mojo::ApplicationDelegate* delegate = mojo::ApplicationDelegate::Create(); | 80 // TODO(tim): Perhaps the delegate should be the thing that provides |
| 80 mojo::ApplicationImpl app(delegate); | 81 // the ExampleServiceTest with the ApplicationImpl somehow. |
| 81 app.BindShell(shell_handle); | 82 mojo::ApplicationDelegate* delegate = new mojo::ExampleClientApplication(); |
| 83 mojo::ApplicationImpl app(delegate, shell_handle); |
| 82 g_application_impl_hack = &app; | 84 g_application_impl_hack = &app; |
| 83 | 85 |
| 84 // TODO(msw): Get actual commandline arguments. | 86 // TODO(msw): Get actual commandline arguments. |
| 85 int argc = 0; | 87 int argc = 0; |
| 86 char** argv = NULL; | 88 char** argv = NULL; |
| 87 testing::InitGoogleTest(&argc, argv); | 89 testing::InitGoogleTest(&argc, argv); |
| 88 mojo_ignore_result(RUN_ALL_TESTS()); | 90 mojo_ignore_result(RUN_ALL_TESTS()); |
| 89 | 91 |
| 90 delete delegate; | 92 delete delegate; |
| 91 return MOJO_RESULT_OK; | 93 return MOJO_RESULT_OK; |
| 92 } | 94 } |
| OLD | NEW |