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

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

Issue 2754003005: Mojo C++ Bindings: fix mojom::Foo::Deserialize() for component build. (Closed)
Patch Set: . Created 3 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
« no previous file with comments | « mojo/public/cpp/bindings/tests/BUILD.gn ('k') | mojo/public/interfaces/bindings/tests/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 13ba507e153ed1792f6bf2dae90ff7e7995c9ea2..a6870527065dc9aa906f07d1775c4e760cee4725 100644
--- a/mojo/public/cpp/bindings/tests/struct_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/struct_unittest.cc
@@ -9,6 +9,7 @@
#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
#include "mojo/public/cpp/system/message_pipe.h"
+#include "mojo/public/interfaces/bindings/tests/test_export2.mojom.h"
#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -435,7 +436,7 @@ TEST_F(StructTest, Serialization_PublicAPI) {
// Initialize it to non-null.
RectPtr output(Rect::New());
- ASSERT_TRUE(Rect::Deserialize(std::move(data), &output));
+ ASSERT_TRUE(Rect::Deserialize(data, &output));
EXPECT_TRUE(output.is_null());
}
@@ -446,7 +447,7 @@ TEST_F(StructTest, Serialization_PublicAPI) {
EXPECT_FALSE(data.empty());
EmptyStructPtr output;
- ASSERT_TRUE(EmptyStruct::Deserialize(std::move(data), &output));
+ ASSERT_TRUE(EmptyStruct::Deserialize(data, &output));
EXPECT_FALSE(output.is_null());
}
@@ -457,7 +458,7 @@ TEST_F(StructTest, Serialization_PublicAPI) {
auto data = Rect::Serialize(&rect);
RectPtr output;
- ASSERT_TRUE(Rect::Deserialize(std::move(data), &output));
+ ASSERT_TRUE(Rect::Deserialize(data, &output));
EXPECT_TRUE(output.Equals(cloned_rect));
}
@@ -475,7 +476,7 @@ TEST_F(StructTest, Serialization_PublicAPI) {
// Make sure that the serialized result gets pointers encoded properly.
auto cloned_data = data;
NamedRegionPtr output;
- ASSERT_TRUE(NamedRegion::Deserialize(std::move(cloned_data), &output));
+ ASSERT_TRUE(NamedRegion::Deserialize(cloned_data, &output));
EXPECT_TRUE(output.Equals(cloned_region));
}
@@ -485,7 +486,17 @@ TEST_F(StructTest, Serialization_PublicAPI) {
auto data = Rect::Serialize(&rect);
NamedRegionPtr output;
- EXPECT_FALSE(NamedRegion::Deserialize(std::move(data), &output));
+ EXPECT_FALSE(NamedRegion::Deserialize(data, &output));
+ }
+
+ {
+ // A struct from another component.
+ auto pair = test_export2::StringPair::New("hello", "world");
+ auto data = test_export2::StringPair::Serialize(&pair);
+
+ test_export2::StringPairPtr output;
+ ASSERT_TRUE(test_export2::StringPair::Deserialize(data, &output));
+ EXPECT_TRUE(output.Equals(pair));
}
}
« no previous file with comments | « mojo/public/cpp/bindings/tests/BUILD.gn ('k') | mojo/public/interfaces/bindings/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698