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

Unified Diff: mojo/service_manager/service_manager_unittest.cc

Issue 275363002: Internalize ServiceConnector<> (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 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
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 a371f956aced3c3fdddd400232791453bfd4a773..e6466b1fc74294e4f6b49a75df366917d440f545 100644
--- a/mojo/service_manager/service_manager_unittest.cc
+++ b/mojo/service_manager/service_manager_unittest.cc
@@ -24,31 +24,32 @@ struct TestContext {
int num_loader_deletes;
};
-class TestServiceImpl :
- public ServiceConnection<TestService, TestServiceImpl, TestContext> {
+class TestServiceImpl : public InterfaceImpl<TestService> {
public:
- TestServiceImpl() : client_(NULL) {}
+ TestServiceImpl(TestContext* context) : context_(context), client_(NULL) {
+ ++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 SetClient(TestClient* client) OVERRIDE {
client_ = client;
}
+
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_;
TestClient* client_;
};
@@ -106,8 +107,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,

Powered by Google App Engine
This is Rietveld 408576698