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

Unified Diff: mojo/service_manager/service_manager_unittest.cc

Issue 287143003: Mojo: Internalize ServiceConnector<> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing function Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/shell/service.h ('k') | mojo/services/dbus_echo/dbus_echo_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/service_manager/service_manager_unittest.cc
diff --git a/mojo/service_manager/service_manager_unittest.cc b/mojo/service_manager/service_manager_unittest.cc
index 0e6b0695a3f0ca27b0bf5bebbda3657d3892c4f1..3d21dc80277d28d741e2f6f117726a1c2141cd16 100644
--- a/mojo/service_manager/service_manager_unittest.cc
+++ b/mojo/service_manager/service_manager_unittest.cc
@@ -24,24 +24,28 @@ struct TestContext {
int num_loader_deletes;
};
-class TestServiceImpl :
- public ServiceConnection<TestService, TestServiceImpl, TestContext> {
+class TestServiceImpl : public InterfaceImpl<TestService> {
public:
+ explicit TestServiceImpl(TestContext* context) : context_(context) {
+ ++context_->num_impls;
+ }
+
virtual ~TestServiceImpl() {
- if (context())
- --context()->num_impls;
+ --context_->num_impls;
}
- void Initialize() {
- if (context())
- ++context()->num_impls;
+ // InterfaceImpl<TestService> implementation.
+ virtual void OnConnectionError() OVERRIDE {
}
// TestService implementation:
virtual void Test(const mojo::String& test_string) OVERRIDE {
- context()->last_test_string = test_string.To<std::string>();
+ context_->last_test_string = test_string.To<std::string>();
client()->AckTest();
}
+
+ private:
+ TestContext* context_;
};
class TestClientImpl : public TestClient {
@@ -98,8 +102,7 @@ class TestServiceLoader : public ServiceLoader {
ScopedMessagePipeHandle shell_handle) OVERRIDE {
++num_loads_;
test_app_.reset(new Application(shell_handle.Pass()));
- test_app_->AddServiceConnector(
- new ServiceConnector<TestServiceImpl, TestContext>(context_));
+ test_app_->AddService<TestServiceImpl>(context_);
}
virtual void OnServiceError(ServiceManager* manager,
« no previous file with comments | « mojo/public/cpp/shell/service.h ('k') | mojo/services/dbus_echo/dbus_echo_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698