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

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

Issue 1800753005: C++ bindings: A struct's Deserialize() now does validation before deserializing. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fix char* - >char bug in unittest. FixedBuffer can accept sizes that aren't 8 byte multiples. Created 4 years, 9 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/buffer_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/buffer_unittest.cc b/mojo/public/cpp/bindings/tests/buffer_unittest.cc
index 317a2a516025a237b2e6246163e41f968ba9d09e..96acdd90c8ef3e8ce9f55e8452c9b2ce3e4b2de9 100644
--- a/mojo/public/cpp/bindings/tests/buffer_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/buffer_unittest.cc
@@ -21,6 +21,14 @@ bool IsZero(void* p_buf, size_t size) {
return true;
}
+// Tests that you can create a FixedBuffer whose underlying buffer size is not
+// a multiple of 8.
+TEST(FixedBufferTest, UnAlignedBufferSized) {
+ char char_buf[10] = {};
+ internal::FixedBuffer fixed_buf;
+ fixed_buf.Initialize(char_buf, sizeof(char_buf));
+}
+
// Tests that FixedBuffer allocates memory aligned to 8 byte boundaries.
TEST(FixedBufferTest, Alignment) {
internal::FixedBufferForTesting buf(internal::Align(10) * 2);
« no previous file with comments | « mojo/public/cpp/bindings/lib/validation_errors.h ('k') | mojo/public/cpp/bindings/tests/serialization_api_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698