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

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

Issue 1387993002: mojo::Serialize*_() calls now propogate/return validation errors. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Cleaned up how serialization errors propagate, and addressed other comments from viettrungluu@ Created 5 years, 2 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/struct_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/struct_unittest.cc b/mojo/public/cpp/bindings/tests/struct_unittest.cc
index 283dd8eea9db2b93efd23e5c0056e7c2bb09c42c..82b9366a507f201a2af02fba5b76fefe7f27f5bd 100644
--- a/mojo/public/cpp/bindings/tests/struct_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/struct_unittest.cc
@@ -5,6 +5,7 @@
#include <string.h>
#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
+#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/environment/environment.h"
#include "mojo/public/cpp/system/message_pipe.h"
#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
@@ -54,7 +55,8 @@ U SerializeAndDeserialize(T input) {
size_t size = GetSerializedSize_(*input);
mojo::internal::FixedBufferForTesting buf(size + 32);
InputDataType data;
- Serialize_(input.get(), &buf, &data);
+ EXPECT_EQ(mojo::internal::ValidationError::VALIDATION_ERROR_NONE,
+ Serialize_(input.get(), &buf, &data));
std::vector<Handle> handles;
data->EncodePointersAndHandles(&handles);
@@ -144,7 +146,8 @@ TEST_F(StructTest, Serialization_Basic) {
mojo::internal::FixedBufferForTesting buf(size);
internal::Rect_Data* data;
- Serialize_(rect.get(), &buf, &data);
+ EXPECT_EQ(mojo::internal::ValidationError::VALIDATION_ERROR_NONE,
+ Serialize_(rect.get(), &buf, &data));
RectPtr rect2(Rect::New());
Deserialize_(data, rect2.get());
@@ -177,7 +180,8 @@ TEST_F(StructTest, Serialization_StructPointers) {
mojo::internal::FixedBufferForTesting buf(size);
internal::RectPair_Data* data;
- Serialize_(pair.get(), &buf, &data);
+ EXPECT_EQ(mojo::internal::ValidationError::VALIDATION_ERROR_NONE,
+ Serialize_(pair.get(), &buf, &data));
RectPairPtr pair2(RectPair::New());
Deserialize_(data, pair2.get());
@@ -208,7 +212,8 @@ TEST_F(StructTest, Serialization_ArrayPointers) {
mojo::internal::FixedBufferForTesting buf(size);
internal::NamedRegion_Data* data;
- Serialize_(region.get(), &buf, &data);
+ EXPECT_EQ(mojo::internal::ValidationError::VALIDATION_ERROR_NONE,
+ Serialize_(region.get(), &buf, &data));
NamedRegionPtr region2(NamedRegion::New());
Deserialize_(data, region2.get());
@@ -234,7 +239,8 @@ TEST_F(StructTest, Serialization_NullArrayPointers) {
mojo::internal::FixedBufferForTesting buf(size);
internal::NamedRegion_Data* data;
- Serialize_(region.get(), &buf, &data);
+ EXPECT_EQ(mojo::internal::ValidationError::VALIDATION_ERROR_NONE,
+ Serialize_(region.get(), &buf, &data));
NamedRegionPtr region2(NamedRegion::New());
Deserialize_(data, region2.get());

Powered by Google App Engine
This is Rietveld 408576698