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

Side by Side Diff: mojo/public/cpp/bindings/tests/equals_unittest.cc

Issue 1535943002: Convert Pass()→std::move() in //mojo/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Regenerate correctly Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <utility>
6
5 #include "mojo/public/cpp/bindings/lib/value_traits.h" 7 #include "mojo/public/cpp/bindings/lib/value_traits.h"
6 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h" 8 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
7 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
8 10
9 namespace mojo { 11 namespace mojo {
10 namespace test { 12 namespace test {
11 13
12 namespace { 14 namespace {
13 15
14 RectPtr CreateRect() { 16 RectPtr CreateRect() {
15 RectPtr r = Rect::New(); 17 RectPtr r = Rect::New();
16 r->x = 1; 18 r->x = 1;
17 r->y = 2; 19 r->y = 2;
18 r->width = 3; 20 r->width = 3;
19 r->height = 4; 21 r->height = 4;
20 return r.Pass(); 22 return r;
21 } 23 }
22 24
23 using EqualsTest = testing::Test; 25 using EqualsTest = testing::Test;
24 26
25 } // namespace 27 } // namespace
26 28
27 TEST_F(EqualsTest, NullStruct) { 29 TEST_F(EqualsTest, NullStruct) {
28 RectPtr r1; 30 RectPtr r1;
29 RectPtr r2; 31 RectPtr r2;
30 EXPECT_TRUE(r1.Equals(r2)); 32 EXPECT_TRUE(r1.Equals(r2));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 n2->rects[0] = CreateRect(); 82 n2->rects[0] = CreateRect();
81 EXPECT_TRUE(n1.Equals(n2)); 83 EXPECT_TRUE(n1.Equals(n2));
82 } 84 }
83 85
84 TEST_F(EqualsTest, Map) { 86 TEST_F(EqualsTest, Map) {
85 auto n1(NamedRegion::New()); 87 auto n1(NamedRegion::New());
86 n1->name = "foo"; 88 n1->name = "foo";
87 n1->rects.push_back(CreateRect()); 89 n1->rects.push_back(CreateRect());
88 90
89 Map<std::string, NamedRegionPtr> m1; 91 Map<std::string, NamedRegionPtr> m1;
90 m1.insert("foo", n1.Pass()); 92 m1.insert("foo", std::move(n1));
91 93
92 decltype(m1) m2; 94 decltype(m1) m2;
93 EXPECT_FALSE(m1.Equals(m2)); 95 EXPECT_FALSE(m1.Equals(m2));
94 96
95 m2.insert("bar", m1.at("foo").Clone()); 97 m2.insert("bar", m1.at("foo").Clone());
96 EXPECT_FALSE(m1.Equals(m2)); 98 EXPECT_FALSE(m1.Equals(m2));
97 99
98 m2 = m1.Clone(); 100 m2 = m1.Clone();
99 m2.at("foo")->name = "monkey"; 101 m2.at("foo")->name = "monkey";
100 EXPECT_FALSE(m1.Equals(m2)); 102 EXPECT_FALSE(m1.Equals(m2));
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 EXPECT_FALSE(RequestValueTraits::Equals(req1, req2)); 151 EXPECT_FALSE(RequestValueTraits::Equals(req1, req2));
150 152
151 SomeInterfacePtr inf2; 153 SomeInterfacePtr inf2;
152 req2 = GetProxy(&inf2); 154 req2 = GetProxy(&inf2);
153 155
154 EXPECT_FALSE(RequestValueTraits::Equals(req1, req2)); 156 EXPECT_FALSE(RequestValueTraits::Equals(req1, req2));
155 } 157 }
156 158
157 } // test 159 } // test
158 } // mojo 160 } // mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/tests/connector_unittest.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