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

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

Issue 1882423004: Move shell service to toplevel shell namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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 2015 The Chromium Authors. All rights reserved. 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 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 "base/at_exit.h" 5 #include "base/at_exit.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "mojo/public/cpp/bindings/binding_set.h" 8 #include "mojo/public/cpp/bindings/binding_set.h"
9 #include "services/shell/public/cpp/connection.h" 9 #include "services/shell/public/cpp/connection.h"
10 #include "services/shell/public/cpp/connector.h" 10 #include "services/shell/public/cpp/connector.h"
11 #include "services/shell/public/cpp/shell_client.h" 11 #include "services/shell/public/cpp/shell_client.h"
12 #include "services/shell/runner/child/test_native_main.h" 12 #include "services/shell/runner/child/test_native_main.h"
13 #include "services/shell/runner/init.h" 13 #include "services/shell/runner/init.h"
14 #include "services/shell/tests/connect/connect_test.mojom.h" 14 #include "services/shell/tests/connect/connect_test.mojom.h"
15 15
16 using mojo::shell::test::mojom::ConnectTestService; 16 using shell::test::mojom::ConnectTestService;
17 using mojo::shell::test::mojom::ConnectTestServiceRequest; 17 using shell::test::mojom::ConnectTestServiceRequest;
18 18
19 namespace { 19 namespace {
20 20
21 class Target : public mojo::ShellClient, 21 class Target : public shell::ShellClient,
22 public mojo::InterfaceFactory<ConnectTestService>, 22 public shell::InterfaceFactory<ConnectTestService>,
23 public ConnectTestService { 23 public ConnectTestService {
24 public: 24 public:
25 Target() {} 25 Target() {}
26 ~Target() override {} 26 ~Target() override {}
27 27
28 private: 28 private:
29 // mojo::ShellClient: 29 // shell::ShellClient:
30 void Initialize(mojo::Connector* connector, const mojo::Identity& identity, 30 void Initialize(shell::Connector* connector,
31 const shell::Identity& identity,
31 uint32_t id) override { 32 uint32_t id) override {
32 identity_ = identity; 33 identity_ = identity;
33 } 34 }
34 bool AcceptConnection(mojo::Connection* connection) override { 35 bool AcceptConnection(shell::Connection* connection) override {
35 connection->AddInterface<ConnectTestService>(this); 36 connection->AddInterface<ConnectTestService>(this);
36 return true; 37 return true;
37 } 38 }
38 39
39 // mojo::InterfaceFactory<ConnectTestService>: 40 // shell::InterfaceFactory<ConnectTestService>:
40 void Create(mojo::Connection* connection, 41 void Create(shell::Connection* connection,
41 ConnectTestServiceRequest request) override { 42 ConnectTestServiceRequest request) override {
42 bindings_.AddBinding(this, std::move(request)); 43 bindings_.AddBinding(this, std::move(request));
43 } 44 }
44 45
45 // ConnectTestService: 46 // ConnectTestService:
46 void GetTitle(const GetTitleCallback& callback) override { 47 void GetTitle(const GetTitleCallback& callback) override {
47 callback.Run("connect_test_exe"); 48 callback.Run("connect_test_exe");
48 } 49 }
49 void GetInstance(const GetInstanceCallback& callback) override { 50 void GetInstance(const GetInstanceCallback& callback) override {
50 callback.Run(identity_.instance()); 51 callback.Run(identity_.instance());
51 } 52 }
52 53
53 mojo::Identity identity_; 54 shell::Identity identity_;
54 mojo::BindingSet<ConnectTestService> bindings_; 55 mojo::BindingSet<ConnectTestService> bindings_;
55 56
56 DISALLOW_COPY_AND_ASSIGN(Target); 57 DISALLOW_COPY_AND_ASSIGN(Target);
57 }; 58 };
58 59
59 } // namespace 60 } // namespace
60 61
61 int main(int argc, char** argv) { 62 int main(int argc, char** argv) {
62 base::AtExitManager at_exit; 63 base::AtExitManager at_exit;
63 base::CommandLine::Init(argc, argv); 64 base::CommandLine::Init(argc, argv);
64 65
65 mojo::shell::InitializeLogging(); 66 shell::InitializeLogging();
66 67
67 Target target; 68 Target target;
68 return mojo::shell::TestNativeMain(&target); 69 return shell::TestNativeMain(&target);
69 } 70 }
OLDNEW
« no previous file with comments | « services/shell/tests/connect/connect_test_driver.cc ('k') | services/shell/tests/connect/connect_test_package.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698