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

Unified Diff: services/view_manager/view_manager_service_apptest.cc

Issue 917323003: Use Binding instead of InterfaceImpl in view manager apptest (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/view_manager/view_manager_service_apptest.cc
diff --git a/services/view_manager/view_manager_service_apptest.cc b/services/view_manager/view_manager_service_apptest.cc
index ccd97c74c576f8c68fb0a9ae0aee9da3c877bcbc..adddc4ca59e50180edb91be8a45b057b4c4e705a 100644
--- a/services/view_manager/view_manager_service_apptest.cc
+++ b/services/view_manager/view_manager_service_apptest.cc
@@ -227,10 +227,14 @@ bool HasClonedView(const std::vector<TestView>& views) {
// -----------------------------------------------------------------------------
// A ViewManagerClient implementation that logs all changes to a tracker.
-class ViewManagerClientImpl : public mojo::InterfaceImpl<ViewManagerClient>,
+class ViewManagerClientImpl : public mojo::ViewManagerClient,
public TestChangeTracker::Delegate {
public:
- ViewManagerClientImpl() { tracker_.set_delegate(this); }
+ ViewManagerClientImpl() : binding_(this) { tracker_.set_delegate(this); }
+
+ void Bind(mojo::InterfaceRequest<mojo::ViewManagerClient> request) {
+ binding_.Bind(request.Pass());
+ }
mojo::ViewManagerService* service() { return service_.get(); }
TestChangeTracker* tracker() { return &tracker_; }
@@ -257,6 +261,10 @@ class ViewManagerClientImpl : public mojo::InterfaceImpl<ViewManagerClient>,
embed_run_loop_.reset();
}
+ bool WaitForIncomingMethodCall() {
+ return binding_.WaitForIncomingMethodCall();
+ }
+
private:
// Used when running a nested MessageLoop.
struct WaitState {
@@ -343,6 +351,7 @@ class ViewManagerClientImpl : public mojo::InterfaceImpl<ViewManagerClient>,
// be encountered.
scoped_ptr<WaitState> wait_state_;
+ mojo::Binding<ViewManagerClient> binding_;
DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl);
};
@@ -371,7 +380,7 @@ class ViewManagerClientFactory
void Create(ApplicationConnection* connection,
InterfaceRequest<ViewManagerClient> request) override {
client_impl_.reset(new ViewManagerClientImpl);
- WeakBindToRequest(client_impl_.get(), &request);
+ client_impl_->Bind(request.Pass());
if (run_loop_.get())
run_loop_->Quit();
}
@@ -497,7 +506,7 @@ class ViewManagerServiceAppTest
mojo::ScopedMessagePipeHandle view_manager_client_request) override {
auto typed_request = mojo::MakeRequest<mojo::ViewManagerClient>(
view_manager_client_request.Pass());
- WeakBindToRequest(&vm_client1_, &typed_request);
+ vm_client1_.Bind(typed_request.Pass());
view_manager_setup_run_loop_->Quit();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698