Index: mojo/public/cpp/bindings/tests/router_test_util.h |
diff --git a/mojo/public/cpp/bindings/tests/router_test_util.h b/mojo/public/cpp/bindings/tests/router_test_util.h |
index 05707d68f953be3fbb7c7244ac23137696688729..c6fb372d3f426283dd19e58496bd2cee0a105b2b 100644 |
--- a/mojo/public/cpp/bindings/tests/router_test_util.h |
+++ b/mojo/public/cpp/bindings/tests/router_test_util.h |
@@ -9,6 +9,7 @@ |
#include <string> |
+#include "base/callback.h" |
#include "mojo/public/cpp/bindings/message.h" |
namespace mojo { |
@@ -24,12 +25,15 @@ void AllocResponseMessage(uint32_t name, |
class MessageAccumulator : public MessageReceiver { |
public: |
- explicit MessageAccumulator(MessageQueue* queue); |
+ MessageAccumulator(MessageQueue* queue, |
+ const base::Closure& closure = base::Closure()); |
+ ~MessageAccumulator() override; |
bool Accept(Message* message) override; |
private: |
MessageQueue* queue_; |
+ base::Closure closure_; |
}; |
class ResponseGenerator : public MessageReceiverWithResponderStatus { |
@@ -49,7 +53,8 @@ class ResponseGenerator : public MessageReceiverWithResponderStatus { |
class LazyResponseGenerator : public ResponseGenerator { |
public: |
- LazyResponseGenerator(); |
+ explicit LazyResponseGenerator( |
+ const base::Closure& closure = base::Closure()); |
~LazyResponseGenerator() override; |
@@ -60,6 +65,8 @@ class LazyResponseGenerator : public ResponseGenerator { |
bool responder_is_valid() const { return responder_->IsValid(); } |
+ void set_closure(const base::Closure& closure) { closure_ = closure; } |
+ |
// Sends the response and delete the responder. |
void CompleteWithResponse() { Complete(true); } |
@@ -75,6 +82,7 @@ class LazyResponseGenerator : public ResponseGenerator { |
uint32_t name_; |
uint64_t request_id_; |
std::string request_string_; |
+ base::Closure closure_; |
}; |
} // namespace test |