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

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

Issue 322003002: Mojo message validation tests: add integration tests and move existing conformance tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « mojo/public/cpp/bindings/lib/router.h ('k') | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/router.cc
diff --git a/mojo/public/cpp/bindings/lib/router.cc b/mojo/public/cpp/bindings/lib/router.cc
index 7d0d868a044f536728537f701e254b161ace4b0a..a2be32e9985e6370cde235caf369ad14e392ba4e 100644
--- a/mojo/public/cpp/bindings/lib/router.cc
+++ b/mojo/public/cpp/bindings/lib/router.cc
@@ -57,7 +57,8 @@ Router::Router(ScopedMessagePipeHandle message_pipe,
connector_(message_pipe.Pass(), waiter),
weak_self_(this),
incoming_receiver_(NULL),
- next_request_id_(0) {
+ next_request_id_(0),
+ testing_mode_(false) {
filters_.SetSink(&thunk_);
connector_.set_incoming_receiver(filters_.GetHead());
}
@@ -94,6 +95,11 @@ bool Router::AcceptWithResponder(Message* message,
return true;
}
+void Router::EnableTestingMode() {
+ testing_mode_ = true;
+ connector_.set_enforce_errors_from_incoming_receiver(false);
+}
+
bool Router::HandleIncomingMessage(Message* message) {
if (message->has_flag(kMessageExpectsResponse)) {
if (incoming_receiver_) {
@@ -111,7 +117,7 @@ bool Router::HandleIncomingMessage(Message* message) {
uint64_t request_id = message->request_id();
ResponderMap::iterator it = responders_.find(request_id);
if (it == responders_.end()) {
- assert(false);
+ assert(testing_mode_);
return false;
}
MessageReceiver* responder = it->second;
« no previous file with comments | « mojo/public/cpp/bindings/lib/router.h ('k') | mojo/public/cpp/bindings/lib/validation_errors.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698