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

Unified Diff: mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl

Issue 921223002: Cpp bindings: Return false from Validator::Accept() on unrecognized message or invalid flags (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix test Created 5 years, 10 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/tools/bindings/generators/cpp_templates/interface_definition.tmpl
diff --git a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
index 308c8b67a5060845834470782594e599e915e6a6..292b0ae2b71f97d7bbc54e98fd3d996b35b12de8 100644
--- a/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
+++ b/mojo/public/tools/bindings/generators/cpp_templates/interface_definition.tmpl
@@ -243,6 +243,11 @@ bool {{class_name}}RequestValidator::Accept(mojo::Message* message) {
break;
}
{%- endfor %}
+ default: {
+ // Unrecognized message.
+ ReportValidationError(mojo::internal::VALIDATION_ERROR_UNKOWN_METHOD);
+ return false;
+ }
}
{%- endif %}
@@ -273,6 +278,11 @@ bool {{class_name}}ResponseValidator::Accept(mojo::Message* message) {
break;
}
{%- endfor %}
+ default: {
+ // Unrecognized message.
+ ReportValidationError(mojo::internal::VALIDATION_ERROR_UNKOWN_METHOD);
+ return false;
+ }
}
{%- endif %}

Powered by Google App Engine
This is Rietveld 408576698