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

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

Issue 2689513003: Add field-initializing constructors to generated mojo structs. (Closed)
Patch Set: Created 3 years, 10 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/equals_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/equals_unittest.cc b/mojo/public/cpp/bindings/tests/equals_unittest.cc
index 4862b93f3a22888327a97de3fed28fe8ed8d5144..036d49c317069e598e4b6058b23844b3508b66cd 100644
--- a/mojo/public/cpp/bindings/tests/equals_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/equals_unittest.cc
@@ -14,12 +14,7 @@ namespace test {
namespace {
RectPtr CreateRect() {
- RectPtr r = Rect::New();
- r->x = 1;
- r->y = 2;
- r->width = 3;
- r->height = 4;
- return r;
+ return Rect::New(1, 2, 3, 4);
}
using EqualsTest = testing::Test;
@@ -48,9 +43,7 @@ TEST_F(EqualsTest, Struct) {
}
TEST_F(EqualsTest, StructNested) {
- RectPairPtr p1(RectPair::New());
- p1->first = CreateRect();
- p1->second = CreateRect();
+ RectPairPtr p1(RectPair::New(CreateRect(), CreateRect()));
RectPairPtr p2(p1.Clone());
EXPECT_TRUE(p1.Equals(p2));
p2->second->width = 0;
@@ -60,8 +53,7 @@ TEST_F(EqualsTest, StructNested) {
}
TEST_F(EqualsTest, Array) {
- NamedRegionPtr n1(NamedRegion::New());
- n1->name.emplace("n1");
+ NamedRegionPtr n1(NamedRegion::New(std::string("n1")));
n1->rects.emplace();
n1->rects->push_back(CreateRect());
NamedRegionPtr n2(n1.Clone());

Powered by Google App Engine
This is Rietveld 408576698