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

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

Issue 2076313002: Mojo C++ bindings: expose serialization public API for mojo structs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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/wtf_types_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
index f691085eff0382858715f2a586a73b4f4d2c992e..a17d876c6ef196769a99c58efaf3557e97da2cf8 100644
--- a/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/wtf_types_unittest.cc
@@ -205,6 +205,20 @@ TEST_F(WTFTypesTest, Serialization_WTFMapToMojoMap) {
EXPECT_TRUE(kUTF8HelloWorld == str_map2["2"]);
}
+TEST_F(WTFTypesTest, Serialization_PublicAPI) {
+ blink::TestWTFStructPtr input(blink::TestWTFStruct::New());
+ input->str = kHelloWorld;
+ input->integer = 42;
+
+ blink::TestWTFStructPtr cloned_input = input.Clone();
+
+ WTFArray<uint8_t> data = blink::TestWTFStruct::Serialize(&input);
+
+ blink::TestWTFStructPtr output;
+ ASSERT_TRUE(blink::TestWTFStruct::Deserialize(std::move(data), &output));
+ EXPECT_TRUE(cloned_input.Equals(output));
+}
+
TEST_F(WTFTypesTest, SendString) {
blink::TestWTFPtr ptr;
TestWTFImpl impl(ConvertInterfaceRequest<TestWTF>(GetProxy(&ptr)));
« no previous file with comments | « mojo/public/cpp/bindings/tests/struct_unittest.cc ('k') | mojo/public/interfaces/bindings/tests/test_wtf_types.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698