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

Unified Diff: mojo/public/cpp/bindings/lib/binding_state.cc

Issue 2280483002: Add FlushForTesting to InterfacePtr and Binding. (Closed)
Patch Set: Created 4 years, 4 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/public/cpp/bindings/lib/binding_state.cc
diff --git a/mojo/public/cpp/bindings/lib/binding_state.cc b/mojo/public/cpp/bindings/lib/binding_state.cc
index 6beae550a2378c897f99a580cbdba759e34aa4bd..3170bf46962151332fd35284d84ac74096ea6450 100644
--- a/mojo/public/cpp/bindings/lib/binding_state.cc
+++ b/mojo/public/cpp/bindings/lib/binding_state.cc
@@ -4,6 +4,8 @@
#include "mojo/public/cpp/bindings/lib/binding_state.h"
+#include "mojo/public/cpp/bindings/lib/control_message_proxy.h"
+
namespace mojo {
namespace internal {
@@ -38,6 +40,13 @@ void SimpleBindingState::Close() {
DestroyRouter();
}
+void SimpleBindingState::FlushForTesting() {
+ if (!router_ || router_->encountered_error())
+ return;
+
+ router_->control_message_proxy()->FlushForTesting();
+}
+
void SimpleBindingState::EnableTestingMode() {
DCHECK(is_bound());
router_->EnableTestingMode();
@@ -49,13 +58,15 @@ void SimpleBindingState::BindInternal(
const char* interface_name,
std::unique_ptr<MessageReceiver> request_validator,
bool has_sync_methods,
- MessageReceiverWithResponderStatus* stub) {
+ MessageReceiverWithResponderStatus* stub,
+ uint32_t interface_version) {
FilterChain filters;
filters.Append<MessageHeaderValidator>(interface_name);
filters.Append(std::move(request_validator));
router_ = new internal::Router(std::move(handle), std::move(filters),
- has_sync_methods, std::move(runner));
+ has_sync_methods, std::move(runner),
+ interface_version);
router_->set_incoming_receiver(stub);
router_->set_connection_error_handler(base::Bind(
&SimpleBindingState::RunConnectionErrorHandler, base::Unretained(this)));
@@ -113,6 +124,13 @@ void MultiplexedBindingState::Close() {
connection_error_handler_.Reset();
}
+void MultiplexedBindingState::FlushForTesting() {
+ if (!endpoint_client_ || endpoint_client_->encountered_error())
+ return;
+
+ endpoint_client_->control_message_proxy()->FlushForTesting();
+}
+
void MultiplexedBindingState::EnableTestingMode() {
DCHECK(is_bound());
router_->EnableTestingMode();
@@ -124,7 +142,8 @@ void MultiplexedBindingState::BindInternal(
const char* interface_name,
std::unique_ptr<MessageReceiver> request_validator,
bool has_sync_methods,
- MessageReceiverWithResponderStatus* stub) {
+ MessageReceiverWithResponderStatus* stub,
+ uint32_t interface_version) {
DCHECK(!router_);
router_ = new internal::MultiplexRouter(false, std::move(handle), runner);
@@ -132,7 +151,8 @@ void MultiplexedBindingState::BindInternal(
endpoint_client_.reset(new InterfaceEndpointClient(
router_->CreateLocalEndpointHandle(kMasterInterfaceId), stub,
- std::move(request_validator), has_sync_methods, std::move(runner)));
+ std::move(request_validator), has_sync_methods, std::move(runner),
+ interface_version));
endpoint_client_->set_connection_error_handler(
base::Bind(&MultiplexedBindingState::RunConnectionErrorHandler,

Powered by Google App Engine
This is Rietveld 408576698