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

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

Issue 2419723002: Move services/shell to services/service_manager (Closed)
Patch Set: rebase 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/at_exit.h"
6 #include "base/command_line.h"
7 #include "base/macros.h"
8 #include "mojo/public/cpp/bindings/binding_set.h"
9 #include "services/shell/public/cpp/connection.h"
10 #include "services/shell/public/cpp/connector.h"
11 #include "services/shell/public/cpp/interface_factory.h"
12 #include "services/shell/public/cpp/interface_registry.h"
13 #include "services/shell/public/cpp/service.h"
14 #include "services/shell/runner/child/test_native_main.h"
15 #include "services/shell/runner/init.h"
16 #include "services/shell/tests/connect/connect_test.mojom.h"
17
18 using shell::test::mojom::ConnectTestService;
19 using shell::test::mojom::ConnectTestServiceRequest;
20
21 namespace {
22
23 class Target : public shell::Service,
24 public shell::InterfaceFactory<ConnectTestService>,
25 public ConnectTestService {
26 public:
27 Target() {}
28 ~Target() override {}
29
30 private:
31 // shell::Service:
32 void OnStart(const shell::Identity& identity) override {
33 identity_ = identity;
34 }
35 bool OnConnect(const shell::Identity& remote_identity,
36 shell::InterfaceRegistry* registry) override {
37 registry->AddInterface<ConnectTestService>(this);
38 return true;
39 }
40
41 // shell::InterfaceFactory<ConnectTestService>:
42 void Create(const shell::Identity& remote_identity,
43 ConnectTestServiceRequest request) override {
44 bindings_.AddBinding(this, std::move(request));
45 }
46
47 // ConnectTestService:
48 void GetTitle(const GetTitleCallback& callback) override {
49 callback.Run("connect_test_exe");
50 }
51 void GetInstance(const GetInstanceCallback& callback) override {
52 callback.Run(identity_.instance());
53 }
54
55 shell::Identity identity_;
56 mojo::BindingSet<ConnectTestService> bindings_;
57
58 DISALLOW_COPY_AND_ASSIGN(Target);
59 };
60
61 } // namespace
62
63 int main(int argc, char** argv) {
64 base::AtExitManager at_exit;
65 base::CommandLine::Init(argc, argv);
66
67 shell::InitializeLogging();
68
69 Target target;
70 return shell::TestNativeMain(&target);
71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698