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

Unified Diff: mojo/public/cpp/bindings/associated_binding.h

Issue 2280483002: Add FlushForTesting to InterfacePtr and Binding. (Closed)
Patch Set: Created 4 years, 3 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 | mojo/public/cpp/bindings/associated_interface_ptr.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/associated_binding.h
diff --git a/mojo/public/cpp/bindings/associated_binding.h b/mojo/public/cpp/bindings/associated_binding.h
index 66d7f8e61ec8b62ff56dcb9ac9a9fe0bee92821b..3f991290171cf0a3d1ef5e4588f6ee2064a39d66 100644
--- a/mojo/public/cpp/bindings/associated_binding.h
+++ b/mojo/public/cpp/bindings/associated_binding.h
@@ -19,6 +19,7 @@
#include "mojo/public/cpp/bindings/associated_group_controller.h"
#include "mojo/public/cpp/bindings/associated_interface_request.h"
#include "mojo/public/cpp/bindings/interface_endpoint_client.h"
+#include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
#include "mojo/public/cpp/bindings/scoped_interface_endpoint_handle.h"
namespace mojo {
@@ -103,7 +104,7 @@ class AssociatedBinding {
endpoint_client_.reset(new InterfaceEndpointClient(
std::move(handle), &stub_,
base::WrapUnique(new typename Interface::RequestValidator_()),
- Interface::HasSyncMethods_, std::move(runner)));
+ Interface::HasSyncMethods_, std::move(runner), Interface::Version_));
endpoint_client_->set_connection_error_handler(
base::Bind(&AssociatedBinding::RunConnectionErrorHandler,
base::Unretained(this)));
@@ -165,6 +166,14 @@ class AssociatedBinding {
return endpoint_client_ ? endpoint_client_->associated_group() : nullptr;
}
+ // Sends a message on the underlying message pipe and runs the current
+ // message loop until its response is received. This can be used in tests to
+ // verify that no message was sent on a message pipe in response to some
+ // stimulus.
+ void FlushForTesting() {
+ endpoint_client_->control_message_proxy()->FlushForTesting();
+ }
+
private:
void RunConnectionErrorHandler() {
if (!connection_error_handler_.is_null())
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/associated_interface_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698