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

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

Issue 2136733002: Mojo C++ bindings: add a new mode to generator to use native STL/WTF types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@67_new
Patch Set: . Created 4 years, 5 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 1add5b0b4043f8a0301a15ef4744858a714480ba..376c2bd4ff7bdba3e26e36da890051ae2efec80f 100644
--- a/mojo/public/cpp/bindings/tests/equals_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/equals_unittest.cc
@@ -61,32 +61,34 @@ TEST_F(EqualsTest, StructNested) {
TEST_F(EqualsTest, Array) {
NamedRegionPtr n1(NamedRegion::New());
- n1->name = "n1";
- n1->rects.push_back(CreateRect());
+ n1->name.emplace("n1");
+ n1->rects.emplace();
+ n1->rects->push_back(CreateRect());
NamedRegionPtr n2(n1.Clone());
EXPECT_TRUE(n1.Equals(n2));
- n2->rects = nullptr;
+ n2->rects = base::nullopt;
EXPECT_FALSE(n1.Equals(n2));
- n2->rects.resize(0);
+ n2->rects.emplace();
EXPECT_FALSE(n1.Equals(n2));
- n2->rects.push_back(CreateRect());
- n2->rects.push_back(CreateRect());
+ n2->rects->push_back(CreateRect());
+ n2->rects->push_back(CreateRect());
EXPECT_FALSE(n1.Equals(n2));
- n2->rects.resize(1);
- n2->rects[0]->width = 0;
+ n2->rects->resize(1);
+ (*n2->rects)[0]->width = 0;
EXPECT_FALSE(n1.Equals(n2));
- n2->rects[0] = CreateRect();
+ (*n2->rects)[0] = CreateRect();
EXPECT_TRUE(n1.Equals(n2));
}
TEST_F(EqualsTest, Map) {
auto n1(NamedRegion::New());
- n1->name = "foo";
- n1->rects.push_back(CreateRect());
+ n1->name.emplace("foo");
+ n1->rects.emplace();
+ n1->rects->push_back(CreateRect());
Map<std::string, NamedRegionPtr> m1;
m1.insert("foo", std::move(n1));
@@ -98,15 +100,15 @@ TEST_F(EqualsTest, Map) {
EXPECT_FALSE(m1.Equals(m2));
m2 = m1.Clone();
- m2.at("foo")->name = "monkey";
+ m2.at("foo")->name.emplace("monkey");
EXPECT_FALSE(m1.Equals(m2));
m2 = m1.Clone();
- m2.at("foo")->rects.push_back(Rect::New());
+ m2.at("foo")->rects->push_back(Rect::New());
EXPECT_FALSE(m1.Equals(m2));
- m2.at("foo")->rects.resize(1);
- m2.at("foo")->rects[0]->width = 1;
+ m2.at("foo")->rects->resize(1);
+ (*m2.at("foo")->rects)[0]->width = 1;
EXPECT_FALSE(m1.Equals(m2));
m2 = m1.Clone();
« no previous file with comments | « mojo/public/cpp/bindings/tests/e2e_perftest.cc ('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