Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Side by Side Diff: mojo/public/cpp/application/lib/application_test_base.cc

Issue 1682113003: Mojo C++ bindings: Generate InterfaceHandle<> instead of InterfacePtr<>. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebase ontop of master, address trung's comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « mojo/public/cpp/application/lib/application_impl.cc ('k') | mojo/public/cpp/application/lib/service_registry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698