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

Unified Diff: mojo/public/cpp/bindings/tests/router_test_util.cc

Issue 1552983003: Fix a bunch of mojo_public_*_unittests with the new EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 12 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/tests/router_test_util.cc
diff --git a/mojo/public/cpp/bindings/tests/router_test_util.cc b/mojo/public/cpp/bindings/tests/router_test_util.cc
index c5dbca71af546a46fe7e457558cfb25a11d0a742..6697a7c62ed362ac8b70c923bdf97a4e7e8d0e2c 100644
--- a/mojo/public/cpp/bindings/tests/router_test_util.cc
+++ b/mojo/public/cpp/bindings/tests/router_test_util.cc
@@ -34,10 +34,18 @@ void AllocResponseMessage(uint32_t name,
builder.message()->MoveTo(message);
}
-MessageAccumulator::MessageAccumulator(MessageQueue* queue) : queue_(queue) {}
+MessageAccumulator::MessageAccumulator(MessageQueue* queue,
+ const base::Closure& closure)
+ : queue_(queue), closure_(closure) {}
+
+MessageAccumulator::~MessageAccumulator() {}
bool MessageAccumulator::Accept(Message* message) {
queue_->Push(message);
+ if (!closure_.is_null()) {
+ closure_.Run();
+ closure_.Reset();
+ }
return true;
}
@@ -72,8 +80,8 @@ bool ResponseGenerator::SendResponse(uint32_t name,
return responder->Accept(&response);
}
-LazyResponseGenerator::LazyResponseGenerator()
- : responder_(nullptr), name_(0), request_id_(0) {}
+LazyResponseGenerator::LazyResponseGenerator(const base::Closure& closure)
+ : responder_(nullptr), name_(0), request_id_(0), closure_(closure) {}
LazyResponseGenerator::~LazyResponseGenerator() {
delete responder_;
@@ -87,6 +95,10 @@ bool LazyResponseGenerator::AcceptWithResponder(
request_string_ =
std::string(reinterpret_cast<const char*>(message->payload()));
responder_ = responder;
+ if (!closure_.is_null()) {
+ closure_.Run();
+ closure_.Reset();
+ }
return true;
}
« no previous file with comments | « mojo/public/cpp/bindings/tests/router_test_util.h ('k') | mojo/public/cpp/bindings/tests/router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698