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

Side by Side Diff: services/service_manager/public/cpp/service_test.h

Issue 2645973006: [Service Manager] Get rid of dynamic service discovery (Closed)
Patch Set: . Created 3 years, 11 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_PUBLIC_CPP_SERVICE_TEST_H_ 5 #ifndef SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_TEST_H_
6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_TEST_H_ 6 #define SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_TEST_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "services/service_manager/public/cpp/connector.h" 11 #include "services/service_manager/public/cpp/connector.h"
12 #include "services/service_manager/public/cpp/service.h" 12 #include "services/service_manager/public/cpp/service.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace base { 15 namespace base {
16 class MessageLoop; 16 class MessageLoop;
17 class Thread;
18 }
19
20 namespace mojo {
21 namespace edk {
22 class ScopedIPCSupport;
23 }
17 } 24 }
18 25
19 namespace service_manager { 26 namespace service_manager {
20 27
21 class BackgroundServiceManager; 28 class BackgroundServiceManager;
22 class ServiceContext; 29 class ServiceContext;
23 30
24 namespace test { 31 namespace test {
25 32
26 class ServiceTest; 33 class ServiceTest;
(...skipping 18 matching lines...) Expand all
45 DISALLOW_COPY_AND_ASSIGN(ServiceTestClient); 52 DISALLOW_COPY_AND_ASSIGN(ServiceTestClient);
46 }; 53 };
47 54
48 class ServiceTest : public testing::Test { 55 class ServiceTest : public testing::Test {
49 public: 56 public:
50 ServiceTest(); 57 ServiceTest();
51 // Initialize passing the name to use as the identity for the test itself. 58 // Initialize passing the name to use as the identity for the test itself.
52 // Once set via this constructor, it cannot be changed later by calling 59 // Once set via this constructor, it cannot be changed later by calling
53 // InitTestName(). The test executable must provide a manifest in the 60 // InitTestName(). The test executable must provide a manifest in the
54 // appropriate location that specifies this name also. 61 // appropriate location that specifies this name also.
55 explicit ServiceTest(const std::string& test_name, bool init_edk = true); 62 explicit ServiceTest(const std::string& test_name, bool init_edk = false);
56 ~ServiceTest() override; 63 ~ServiceTest() override;
57 64
58 protected: 65 protected:
59 // See constructor. Can only be called once. 66 // See constructor. Can only be called once.
60 void InitTestName(const std::string& test_name); 67 void InitTestName(const std::string& test_name);
61 68
62 Connector* connector() { return connector_; } 69 Connector* connector() { return connector_; }
63 70
64 // Instance information received from the Service Manager during OnStart(). 71 // Instance information received from the Service Manager during OnStart().
65 const std::string& test_name() const { return initialize_name_; } 72 const std::string& test_name() const { return initialize_name_; }
(...skipping 20 matching lines...) Expand all
86 private: 93 private:
87 friend ServiceTestClient; 94 friend ServiceTestClient;
88 95
89 std::unique_ptr<ServiceContext> context_; 96 std::unique_ptr<ServiceContext> context_;
90 std::unique_ptr<base::MessageLoop> message_loop_; 97 std::unique_ptr<base::MessageLoop> message_loop_;
91 std::unique_ptr<BackgroundServiceManager> background_service_manager_; 98 std::unique_ptr<BackgroundServiceManager> background_service_manager_;
92 99
93 // See constructor. 100 // See constructor.
94 std::string test_name_; 101 std::string test_name_;
95 bool init_edk_ = true; 102 bool init_edk_ = true;
103 std::unique_ptr<base::Thread> ipc_thread_;
104 std::unique_ptr<mojo::edk::ScopedIPCSupport> ipc_support_;
96 105
97 Connector* connector_ = nullptr; 106 Connector* connector_ = nullptr;
98 std::string initialize_name_; 107 std::string initialize_name_;
99 std::string initialize_userid_ = service_manager::mojom::kInheritUserID; 108 std::string initialize_userid_ = service_manager::mojom::kInheritUserID;
100 uint32_t initialize_instance_id_ = service_manager::mojom::kInvalidInstanceID; 109 uint32_t initialize_instance_id_ = service_manager::mojom::kInvalidInstanceID;
101 110
102 base::Closure initialize_called_; 111 base::Closure initialize_called_;
103 112
104 DISALLOW_COPY_AND_ASSIGN(ServiceTest); 113 DISALLOW_COPY_AND_ASSIGN(ServiceTest);
105 }; 114 };
106 115
107 } // namespace test 116 } // namespace test
108 } // namespace service_manager 117 } // namespace service_manager
109 118
110 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_TEST_H_ 119 #endif // SERVICES_SERVICE_MANAGER_PUBLIC_CPP_SERVICE_TEST_H_
OLDNEW
« no previous file with comments | « services/service_manager/public/cpp/service.gni ('k') | services/service_manager/public/cpp/standalone_service/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698