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

Side by Side Diff: services/service_manager/background/tests/test_service.cc

Issue 2850743004: Replace ServiceInfo with BindSourceInfo. (Closed)
Patch Set: . Created 3 years, 7 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 "mojo/public/cpp/bindings/binding_set.h" 5 #include "mojo/public/cpp/bindings/binding_set.h"
6 #include "services/service_manager/background/tests/test.mojom.h" 6 #include "services/service_manager/background/tests/test.mojom.h"
7 #include "services/service_manager/public/c/main.h" 7 #include "services/service_manager/public/c/main.h"
8 #include "services/service_manager/public/cpp/binder_registry.h" 8 #include "services/service_manager/public/cpp/binder_registry.h"
9 #include "services/service_manager/public/cpp/service.h" 9 #include "services/service_manager/public/cpp/service.h"
10 #include "services/service_manager/public/cpp/service_context.h" 10 #include "services/service_manager/public/cpp/service_context.h"
11 #include "services/service_manager/public/cpp/service_runner.h" 11 #include "services/service_manager/public/cpp/service_runner.h"
12 12
13 namespace service_manager { 13 namespace service_manager {
14 14
15 // A service that exports a simple interface for testing. Used to test the 15 // A service that exports a simple interface for testing. Used to test the
16 // parent background service manager. 16 // parent background service manager.
17 class TestClient : public Service, 17 class TestClient : public Service,
18 public InterfaceFactory<mojom::TestService>, 18 public InterfaceFactory<mojom::TestService>,
19 public mojom::TestService { 19 public mojom::TestService {
20 public: 20 public:
21 TestClient() { registry_.AddInterface(this); } 21 TestClient() { registry_.AddInterface(this); }
22 ~TestClient() override {} 22 ~TestClient() override {}
23 23
24 private: 24 private:
25 // Service: 25 // Service:
26 void OnBindInterface(const ServiceInfo& source_info, 26 void OnBindInterface(const BindSourceInfo& source_info,
27 const std::string& interface_name, 27 const std::string& interface_name,
28 mojo::ScopedMessagePipeHandle interface_pipe) override { 28 mojo::ScopedMessagePipeHandle interface_pipe) override {
29 registry_.BindInterface(source_info.identity, interface_name, 29 registry_.BindInterface(source_info.identity, interface_name,
30 std::move(interface_pipe)); 30 std::move(interface_pipe));
31 } 31 }
32 32
33 // InterfaceFactory<mojom::TestService>: 33 // InterfaceFactory<mojom::TestService>:
34 void Create(const Identity& remote_identity, 34 void Create(const Identity& remote_identity,
35 mojo::InterfaceRequest<mojom::TestService> request) override { 35 mojo::InterfaceRequest<mojom::TestService> request) override {
36 bindings_.AddBinding(this, std::move(request)); 36 bindings_.AddBinding(this, std::move(request));
(...skipping 11 matching lines...) Expand all
48 48
49 DISALLOW_COPY_AND_ASSIGN(TestClient); 49 DISALLOW_COPY_AND_ASSIGN(TestClient);
50 }; 50 };
51 51
52 } // namespace service_manager 52 } // namespace service_manager
53 53
54 MojoResult ServiceMain(MojoHandle service_request_handle) { 54 MojoResult ServiceMain(MojoHandle service_request_handle) {
55 service_manager::ServiceRunner runner(new service_manager::TestClient); 55 service_manager::ServiceRunner runner(new service_manager::TestClient);
56 return runner.Run(service_request_handle); 56 return runner.Run(service_request_handle);
57 } 57 }
OLDNEW
« no previous file with comments | « services/preferences/pref_store_manager_impl.cc ('k') | services/service_manager/public/cpp/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698