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

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

Issue 1535943002: Convert Pass()→std::move() in //mojo/public/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove self-move checks to avoid triggering clang warning. Created 5 years 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/map_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/map_unittest.cc b/mojo/public/cpp/bindings/tests/map_unittest.cc
index ca17672c5a001bc050a73d1f753659168acd86b8..905f9f44b4159eb6d626e1fb567ae7ff135d845f 100644
--- a/mojo/public/cpp/bindings/tests/map_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/map_unittest.cc
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <utility>
+
#include "mojo/public/cpp/bindings/array.h"
#include "mojo/public/cpp/bindings/lib/array_serialization.h"
#include "mojo/public/cpp/bindings/lib/bindings_internal.h"
@@ -79,7 +81,7 @@ TEST_F(MapTest, TestIndexOperatorMoveOnly) {
const char* key = kStringIntData[i].string_data;
Array<int32_t> array(1);
array[0] = kStringIntData[i].int_data;
- map[key] = array.Pass();
+ map[key] = std::move(array);
EXPECT_TRUE(map);
}
@@ -100,7 +102,7 @@ TEST_F(MapTest, ConstructedFromArray) {
values[i] = kStringIntData[i].int_data;
}
- Map<String, int> map(keys.Pass(), values.Pass());
+ Map<String, int> map(std::move(keys), std::move(values));
for (size_t i = 0; i < kStringIntDataSize; ++i) {
EXPECT_EQ(kStringIntData[i].int_data,
@@ -116,7 +118,7 @@ TEST_F(MapTest, DecomposeMapTo) {
values[i] = kStringIntData[i].int_data;
}
- Map<String, int> map(keys.Pass(), values.Pass());
+ Map<String, int> map(std::move(keys), std::move(values));
EXPECT_EQ(kStringIntDataSize, map.size());
Array<String> keys2;
@@ -181,7 +183,7 @@ TEST_F(MapTest, Insert_MoveOnly) {
const char* key = kStringIntData[i].string_data;
MoveOnlyType value;
value_ptrs.push_back(value.ptr());
- map.insert(key, value.Pass());
+ map.insert(key, std::move(value));
ASSERT_EQ(i + 1, map.size());
ASSERT_EQ(i + 1, value_ptrs.size());
EXPECT_EQ(map.size() + 1, MoveOnlyType::num_instances());
@@ -207,7 +209,7 @@ TEST_F(MapTest, IndexOperator_MoveOnly) {
const char* key = kStringIntData[i].string_data;
MoveOnlyType value;
value_ptrs.push_back(value.ptr());
- map[key] = value.Pass();
+ map[key] = std::move(value);
ASSERT_EQ(i + 1, map.size());
ASSERT_EQ(i + 1, value_ptrs.size());
EXPECT_EQ(map.size() + 1, MoveOnlyType::num_instances());
@@ -255,7 +257,7 @@ TEST_F(MapTest, MapArrayClone) {
for (size_t i = 0; i < kStringIntDataSize; ++i) {
Array<String> s;
s.push_back(kStringIntData[i].string_data);
- m.insert(kStringIntData[i].string_data, s.Pass());
+ m.insert(kStringIntData[i].string_data, std::move(s));
}
Map<String, Array<String>> m2 = m.Clone();
@@ -276,7 +278,7 @@ TEST_F(MapTest, ArrayOfMap) {
Array_Data<Map_Data<int32_t, int8_t>*>* data;
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(0, false, nullptr));
- SerializeArray_(array.Pass(), &buf, &data, &validate_params);
+ SerializeArray_(std::move(array), &buf, &data, &validate_params);
Array<Map<int32_t, int8_t>> deserialized_array;
Deserialize_(data, &deserialized_array, nullptr);
@@ -291,7 +293,7 @@ TEST_F(MapTest, ArrayOfMap) {
Array<bool> map_value(2);
map_value[0] = false;
map_value[1] = true;
- array[0].insert("hello world", map_value.Pass());
+ array[0].insert("hello world", std::move(map_value));
size_t size = GetSerializedSize_(array);
FixedBufferForTesting buf(size);
@@ -299,7 +301,7 @@ TEST_F(MapTest, ArrayOfMap) {
ArrayValidateParams validate_params(
0, false, new ArrayValidateParams(
0, false, new ArrayValidateParams(0, false, nullptr)));
- SerializeArray_(array.Pass(), &buf, &data, &validate_params);
+ SerializeArray_(std::move(array), &buf, &data, &validate_params);
Array<Map<String, Array<bool>>> deserialized_array;
Deserialize_(data, &deserialized_array, nullptr);

Powered by Google App Engine
This is Rietveld 408576698