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

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: Regenerate correctly 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 e13878bdceda2195a93169773e4a30e3913e1e75..444e0b375dfa74b1f524b04c6edf8483458fac70 100644
--- a/mojo/public/cpp/bindings/tests/map_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/map_unittest.cc
@@ -2,15 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "mojo/public/cpp/bindings/map.h"
+
#include <stddef.h>
#include <stdint.h>
+#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"
#include "mojo/public/cpp/bindings/lib/fixed_buffer.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
-#include "mojo/public/cpp/bindings/map.h"
#include "mojo/public/cpp/bindings/string.h"
#include "mojo/public/cpp/bindings/tests/container_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -82,7 +84,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);
}
@@ -103,7 +105,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,
@@ -119,7 +121,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;
@@ -184,7 +186,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());
@@ -210,7 +212,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());
@@ -258,7 +260,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();
@@ -279,7 +281,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);
@@ -294,7 +296,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);
@@ -302,7 +304,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);
« no previous file with comments | « mojo/public/cpp/bindings/tests/interface_ptr_unittest.cc ('k') | mojo/public/cpp/bindings/tests/multiplex_router_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698