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/public/cpp/application/application_test_base.h" | 5 #include "mojo/public/cpp/application/application_test_base.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "mojo/public/cpp/application/application_impl.h" | 9 #include "mojo/public/cpp/application/application_impl.h" |
8 #include "mojo/public/cpp/bindings/binding.h" | 10 #include "mojo/public/cpp/bindings/binding.h" |
9 #include "mojo/public/cpp/environment/environment.h" | 11 #include "mojo/public/cpp/environment/environment.h" |
10 #include "mojo/public/cpp/system/message_pipe.h" | 12 #include "mojo/public/cpp/system/message_pipe.h" |
11 #include "mojo/public/interfaces/application/application.mojom.h" | 13 #include "mojo/public/interfaces/application/application.mojom.h" |
12 | 14 |
13 namespace mojo { | 15 namespace mojo { |
14 namespace test { | 16 namespace test { |
15 | 17 |
16 namespace { | 18 namespace { |
(...skipping 26 matching lines...) Expand all Loading... |
43 InterfaceRequest<Application> application_request) | 45 InterfaceRequest<Application> application_request) |
44 : args_(args), binding_(this, application_request.Pass()) {} | 46 : args_(args), binding_(this, application_request.Pass()) {} |
45 | 47 |
46 void WaitForInitialize() { | 48 void WaitForInitialize() { |
47 // Initialize is always the first call made on Application. | 49 // Initialize is always the first call made on Application. |
48 MOJO_CHECK(binding_.WaitForIncomingMethodCall()); | 50 MOJO_CHECK(binding_.WaitForIncomingMethodCall()); |
49 } | 51 } |
50 | 52 |
51 private: | 53 private: |
52 // Application implementation. | 54 // Application implementation. |
53 void Initialize(ShellPtr shell, | 55 void Initialize(InterfaceHandle<Shell> shell, |
54 Array<String> args, | 56 Array<String> args, |
55 const mojo::String& url) override { | 57 const mojo::String& url) override { |
56 *args_ = args.Pass(); | 58 *args_ = args.Pass(); |
57 g_url = url; | 59 g_url = url; |
58 g_application_request = binding_.Unbind(); | 60 g_application_request = binding_.Unbind(); |
59 g_shell = shell.Pass(); | 61 g_shell = ShellPtr::Create(std::move(shell)); |
60 } | 62 } |
61 | 63 |
62 void AcceptConnection(const String& requestor_url, | 64 void AcceptConnection(const String& requestor_url, |
63 InterfaceRequest<ServiceProvider> services, | 65 InterfaceRequest<ServiceProvider> services, |
64 ServiceProviderPtr exposed_services, | 66 InterfaceHandle<ServiceProvider> exposed_services, |
65 const String& url) override { | 67 const String& url) override { |
66 MOJO_CHECK(false); | 68 MOJO_CHECK(false); |
67 } | 69 } |
68 | 70 |
69 void RequestQuit() override { MOJO_CHECK(false); } | 71 void RequestQuit() override { MOJO_CHECK(false); } |
70 | 72 |
71 Array<String>* args_; | 73 Array<String>* args_; |
72 Binding<Application> binding_; | 74 Binding<Application> binding_; |
73 }; | 75 }; |
74 | 76 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 if (ShouldCreateDefaultRunLoop()) | 158 if (ShouldCreateDefaultRunLoop()) |
157 Environment::DestroyDefaultRunLoop(); | 159 Environment::DestroyDefaultRunLoop(); |
158 } | 160 } |
159 | 161 |
160 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { | 162 bool ApplicationTestBase::ShouldCreateDefaultRunLoop() { |
161 return true; | 163 return true; |
162 } | 164 } |
163 | 165 |
164 } // namespace test | 166 } // namespace test |
165 } // namespace mojo | 167 } // namespace mojo |
OLD | NEW |