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

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

Issue 1052993010: Adds method ordinal off-by-one error detection testing to ValidationTest. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebased. Created 5 years, 8 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 | « no previous file | mojo/public/interfaces/bindings/tests/data/validation/boundscheck_msghdr_no_such_method.data » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/tests/validation_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/validation_unittest.cc b/mojo/public/cpp/bindings/tests/validation_unittest.cc
index c15ff0291a7b74d3df324f98c6ad333d626bdc10..b56580f1fbd185a152772b69a6b2d965cef97954 100644
--- a/mojo/public/cpp/bindings/tests/validation_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/validation_unittest.cc
@@ -371,6 +371,18 @@ TEST_F(ValidationTest, Conformance) {
RunValidationTests("conformance_", validators.GetHead());
}
+// This test is similar to Conformance test but its goal is specifically
+// do bounds-check testing of message validation. For example we test the
+// detection of off-by-one errors in method ordinals.
+TEST_F(ValidationTest, BoundsCheck) {
+ DummyMessageReceiver dummy_receiver;
+ mojo::internal::FilterChain validators(&dummy_receiver);
+ validators.Append<mojo::internal::MessageHeaderValidator>();
+ validators.Append<BoundsCheckTestInterface::RequestValidator_>();
+
+ RunValidationTests("boundscheck_", validators.GetHead());
+}
+
// This test is similar to the Conformance test but for responses.
TEST_F(ValidationTest, ResponseConformance) {
DummyMessageReceiver dummy_receiver;
@@ -381,6 +393,16 @@ TEST_F(ValidationTest, ResponseConformance) {
RunValidationTests("resp_conformance_", validators.GetHead());
}
+// This test is similar to the BoundsCheck test but for responses.
+TEST_F(ValidationTest, ResponseBoundsCheck) {
+ DummyMessageReceiver dummy_receiver;
+ mojo::internal::FilterChain validators(&dummy_receiver);
+ validators.Append<mojo::internal::MessageHeaderValidator>();
+ validators.Append<BoundsCheckTestInterface::ResponseValidator_>();
+
+ RunValidationTests("resp_boundscheck_", validators.GetHead());
+}
+
// Test that InterfacePtr<X> applies the correct validators and they don't
// conflict with each other:
// - MessageHeaderValidator
« no previous file with comments | « no previous file | mojo/public/interfaces/bindings/tests/data/validation/boundscheck_msghdr_no_such_method.data » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698