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

Side by Side Diff: services/service_manager/tests/lifecycle/app_client.h

Issue 2804373002: Eliminate Connector::Connect(), Connection, etc. (Closed)
Patch Set: . Created 3 years, 8 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 #ifndef SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_ 5 #ifndef SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_
6 #define SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_ 6 #define SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "mojo/public/cpp/bindings/binding_set.h" 12 #include "mojo/public/cpp/bindings/binding_set.h"
13 #include "services/service_manager/public/cpp/binder_registry.h"
13 #include "services/service_manager/public/cpp/interface_factory.h" 14 #include "services/service_manager/public/cpp/interface_factory.h"
14 #include "services/service_manager/public/cpp/service.h" 15 #include "services/service_manager/public/cpp/service.h"
15 #include "services/service_manager/public/cpp/service_runner.h" 16 #include "services/service_manager/public/cpp/service_runner.h"
16 #include "services/service_manager/public/interfaces/service.mojom.h" 17 #include "services/service_manager/public/interfaces/service.mojom.h"
17 #include "services/service_manager/tests/lifecycle/lifecycle_unittest.mojom.h" 18 #include "services/service_manager/tests/lifecycle/lifecycle_unittest.mojom.h"
18 19
19 namespace service_manager { 20 namespace service_manager {
20 namespace test { 21 namespace test {
21 22
22 class AppClient : public Service, 23 class AppClient : public Service,
23 public InterfaceFactory<mojom::LifecycleControl>, 24 public InterfaceFactory<mojom::LifecycleControl>,
24 public mojom::LifecycleControl { 25 public mojom::LifecycleControl {
25 public: 26 public:
26 AppClient(); 27 AppClient();
27 ~AppClient() override; 28 ~AppClient() override;
28 29
29 void set_runner(ServiceRunner* runner) { runner_ = runner; } 30 void set_runner(ServiceRunner* runner) { runner_ = runner; }
30 31
31 // Service: 32 // Service:
32 bool OnConnect(const ServiceInfo& remote_info, 33 void OnBindInterface(const ServiceInfo& source_info,
33 InterfaceRegistry* registry) override; 34 const std::string& interface_name,
35 mojo::ScopedMessagePipeHandle interface_pipe) override;
34 bool OnServiceManagerConnectionLost() override; 36 bool OnServiceManagerConnectionLost() override;
35 37
36 // InterfaceFactory<LifecycleControl>: 38 // InterfaceFactory<LifecycleControl>:
37 void Create(const Identity& remote_identity, 39 void Create(const Identity& remote_identity,
38 mojom::LifecycleControlRequest request) override; 40 mojom::LifecycleControlRequest request) override;
39 41
40 // LifecycleControl: 42 // LifecycleControl:
41 void Ping(const PingCallback& callback) override; 43 void Ping(const PingCallback& callback) override;
42 void GracefulQuit() override; 44 void GracefulQuit() override;
43 void Crash() override; 45 void Crash() override;
44 void CloseServiceManagerConnection() override; 46 void CloseServiceManagerConnection() override;
45 47
46 private: 48 private:
47 class ServiceImpl; 49 class ServiceImpl;
48 50
49 void BindingLost(); 51 void BindingLost();
50 52
51 ServiceRunner* runner_ = nullptr; 53 ServiceRunner* runner_ = nullptr;
54 BinderRegistry registry_;
52 mojo::BindingSet<mojom::LifecycleControl> bindings_; 55 mojo::BindingSet<mojom::LifecycleControl> bindings_;
53 56
54 DISALLOW_COPY_AND_ASSIGN(AppClient); 57 DISALLOW_COPY_AND_ASSIGN(AppClient);
55 }; 58 };
56 59
57 } // namespace test 60 } // namespace test
58 } // namespace service_manager 61 } // namespace service_manager
59 62
60 #endif // SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_ 63 #endif // SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_
OLDNEW
« no previous file with comments | « services/service_manager/tests/connect/connect_unittest.cc ('k') | services/service_manager/tests/lifecycle/app_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698