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

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

Issue 1953493002: Mojo C++ bindings: custom type mapping for array - part 2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@21_simplify
Patch Set: Created 4 years, 7 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/map_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/map_unittest.cc b/mojo/public/cpp/bindings/tests/map_unittest.cc
index e4d2bee8d5544e961e69c20c60eba221b27dd34f..f0ab8e7d00724cef5c5b4b2ab9201173ffd3eb48 100644
--- a/mojo/public/cpp/bindings/tests/map_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/map_unittest.cc
@@ -293,15 +293,20 @@ TEST_F(MapTest, ArrayOfMap) {
Array<Map<int32_t, int8_t>> array(1);
array[0].insert(1, 42);
- size_t size = GetSerializedSize_(array, nullptr);
+ mojo::internal::SerializationContext context;
+ size_t size =
+ mojo::internal::PrepareToSerialize<Array<Map<int32_t, int8_t>>>(
+ array, &context);
FixedBufferForTesting buf(size);
Array_Data<Map_Data<int32_t, int8_t>*>* data;
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(0, false, nullptr));
- SerializeArray_(std::move(array), &buf, &data, &validate_params, nullptr);
+ mojo::internal::Serialize<Array<Map<int32_t, int8_t>>>(
+ array, &buf, &data, &validate_params, &context);
Array<Map<int32_t, int8_t>> deserialized_array;
- Deserialize_(data, &deserialized_array, nullptr);
+ mojo::internal::Deserialize<Array<Map<int32_t, int8_t>>>(
+ data, &deserialized_array, &context);
ASSERT_EQ(1u, deserialized_array.size());
ASSERT_EQ(1u, deserialized_array[0].size());
@@ -315,16 +320,21 @@ TEST_F(MapTest, ArrayOfMap) {
map_value[1] = true;
array[0].insert("hello world", std::move(map_value));
- size_t size = GetSerializedSize_(array, nullptr);
+ mojo::internal::SerializationContext context;
+ size_t size =
+ mojo::internal::PrepareToSerialize<Array<Map<String, Array<bool>>>>(
+ array, &context);
FixedBufferForTesting buf(size);
Array_Data<Map_Data<String_Data*, Array_Data<bool>*>*>* data;
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(
0, false, new ArrayValidateParams(0, false, nullptr)));
- SerializeArray_(std::move(array), &buf, &data, &validate_params, nullptr);
+ mojo::internal::Serialize<Array<Map<String, Array<bool>>>>(
+ array, &buf, &data, &validate_params, &context);
Array<Map<String, Array<bool>>> deserialized_array;
- Deserialize_(data, &deserialized_array, nullptr);
+ mojo::internal::Deserialize<Array<Map<String, Array<bool>>>>(
+ data, &deserialized_array, &context);
ASSERT_EQ(1u, deserialized_array.size());
ASSERT_EQ(1u, deserialized_array[0].size());
« no previous file with comments | « mojo/public/cpp/bindings/tests/array_common_test.h ('k') | mojo/public/cpp/bindings/tests/serialization_warning_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698