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

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

Issue 2689513003: Add field-initializing constructors to generated mojo structs. (Closed)
Patch Set: rebase 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
« no previous file with comments | « mojo/public/cpp/bindings/tests/OWNERS ('k') | mojo/public/cpp/bindings/tests/handle_passing_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6483baf8f081fa6b4f448fbe36f9a42f493a4dfa 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,10 +53,9 @@ TEST_F(EqualsTest, StructNested) {
}
TEST_F(EqualsTest, Array) {
- NamedRegionPtr n1(NamedRegion::New());
- n1->name.emplace("n1");
- n1->rects.emplace();
- n1->rects->push_back(CreateRect());
+ std::vector<RectPtr> rects;
+ rects.push_back(CreateRect());
+ NamedRegionPtr n1(NamedRegion::New(std::string("n1"), std::move(rects)));
NamedRegionPtr n2(n1.Clone());
EXPECT_TRUE(n1.Equals(n2));
« no previous file with comments | « mojo/public/cpp/bindings/tests/OWNERS ('k') | mojo/public/cpp/bindings/tests/handle_passing_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698