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

Side by Side Diff: services/shell/tests/connect/connect_test_app.cc

Issue 2390013002: Rename mojo: to service: (Closed)
Patch Set: . Created 4 years, 2 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 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 <memory> 5 #include <memory>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 void GetInstance(const GetInstanceCallback& callback) override { 112 void GetInstance(const GetInstanceCallback& callback) override {
113 callback.Run(identity_.instance()); 113 callback.Run(identity_.instance());
114 } 114 }
115 115
116 // test::mojom::StandaloneApp: 116 // test::mojom::StandaloneApp:
117 void ConnectToAllowedAppInBlockedPackage( 117 void ConnectToAllowedAppInBlockedPackage(
118 const ConnectToAllowedAppInBlockedPackageCallback& callback) override { 118 const ConnectToAllowedAppInBlockedPackageCallback& callback) override {
119 base::RunLoop run_loop; 119 base::RunLoop run_loop;
120 std::unique_ptr<Connection> connection = 120 std::unique_ptr<Connection> connection =
121 connector()->Connect("mojo:connect_test_a"); 121 connector()->Connect("service:connect_test_a");
122 connection->SetConnectionLostClosure( 122 connection->SetConnectionLostClosure(
123 base::Bind(&ConnectTestApp::OnConnectionBlocked, 123 base::Bind(&ConnectTestApp::OnConnectionBlocked,
124 base::Unretained(this), callback, &run_loop)); 124 base::Unretained(this), callback, &run_loop));
125 test::mojom::ConnectTestServicePtr test_service; 125 test::mojom::ConnectTestServicePtr test_service;
126 connection->GetInterface(&test_service); 126 connection->GetInterface(&test_service);
127 test_service->GetTitle( 127 test_service->GetTitle(
128 base::Bind(&ConnectTestApp::OnGotTitle, base::Unretained(this), 128 base::Bind(&ConnectTestApp::OnGotTitle, base::Unretained(this),
129 callback, &run_loop)); 129 callback, &run_loop));
130 { 130 {
131 // This message is dispatched as a task on the same run loop, so we need 131 // This message is dispatched as a task on the same run loop, so we need
132 // to allow nesting in order to pump additional signals. 132 // to allow nesting in order to pump additional signals.
133 base::MessageLoop::ScopedNestableTaskAllower allow( 133 base::MessageLoop::ScopedNestableTaskAllower allow(
134 base::MessageLoop::current()); 134 base::MessageLoop::current());
135 run_loop.Run(); 135 run_loop.Run();
136 } 136 }
137 } 137 }
138 void ConnectToClassInterface( 138 void ConnectToClassInterface(
139 const ConnectToClassInterfaceCallback& callback) override { 139 const ConnectToClassInterfaceCallback& callback) override {
140 std::unique_ptr<Connection> connection = 140 std::unique_ptr<Connection> connection =
141 connector()->Connect("mojo:connect_test_class_app"); 141 connector()->Connect("service:connect_test_class_app");
142 test::mojom::ClassInterfacePtr class_interface; 142 test::mojom::ClassInterfacePtr class_interface;
143 connection->GetInterface(&class_interface); 143 connection->GetInterface(&class_interface);
144 std::string ping_response; 144 std::string ping_response;
145 { 145 {
146 base::RunLoop loop; 146 base::RunLoop loop;
147 class_interface->Ping(base::Bind(&ReceiveString, &ping_response, &loop)); 147 class_interface->Ping(base::Bind(&ReceiveString, &ping_response, &loop));
148 base::MessageLoop::ScopedNestableTaskAllower allow( 148 base::MessageLoop::ScopedNestableTaskAllower allow(
149 base::MessageLoop::current()); 149 base::MessageLoop::current());
150 loop.Run(); 150 loop.Run();
151 } 151 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 214
215 DISALLOW_COPY_AND_ASSIGN(ConnectTestApp); 215 DISALLOW_COPY_AND_ASSIGN(ConnectTestApp);
216 }; 216 };
217 217
218 } // namespace shell 218 } // namespace shell
219 219
220 MojoResult ServiceMain(MojoHandle service_request_handle) { 220 MojoResult ServiceMain(MojoHandle service_request_handle) {
221 shell::ServiceRunner runner(new shell::ConnectTestApp); 221 shell::ServiceRunner runner(new shell::ConnectTestApp);
222 return runner.Run(service_request_handle); 222 return runner.Run(service_request_handle);
223 } 223 }
OLDNEW
« no previous file with comments | « services/shell/standalone/context.cc ('k') | services/shell/tests/connect/connect_test_app_a_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698