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

Unified Diff: mojo/public/cpp/bindings/tests/array_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/array_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/array_unittest.cc b/mojo/public/cpp/bindings/tests/array_unittest.cc
index b677cc1ff5b5d6477bd22322dd13d7415f9d235e..f9347d0ab0f51676c02723c705bc41d49129fbc0 100644
--- a/mojo/public/cpp/bindings/tests/array_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/array_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_internal.h"
#include "mojo/public/cpp/bindings/lib/array_serialization.h"
@@ -45,17 +47,17 @@ TEST_F(ArrayTest, Bool) {
TEST_F(ArrayTest, Handle) {
MessagePipe pipe;
Array<ScopedMessagePipeHandle> handles(2);
- handles[0] = pipe.handle0.Pass();
+ handles[0] = std::move(pipe.handle0);
handles[1].reset(pipe.handle1.release());
EXPECT_FALSE(pipe.handle0.is_valid());
EXPECT_FALSE(pipe.handle1.is_valid());
- Array<ScopedMessagePipeHandle> handles2 = handles.Pass();
+ Array<ScopedMessagePipeHandle> handles2 = std::move(handles);
EXPECT_TRUE(handles2[0].is_valid());
EXPECT_TRUE(handles2[1].is_valid());
- ScopedMessagePipeHandle pipe_handle = handles2[0].Pass();
+ ScopedMessagePipeHandle pipe_handle = std::move(handles2[0]);
EXPECT_TRUE(pipe_handle.is_valid());
EXPECT_FALSE(handles2[0].is_valid());
}
@@ -68,7 +70,7 @@ TEST_F(ArrayTest, HandlesAreClosed) {
{
Array<ScopedMessagePipeHandle> handles(2);
- handles[0] = pipe.handle0.Pass();
+ handles[0] = std::move(pipe.handle0);
handles[1].reset(pipe.handle0.release());
}
@@ -153,7 +155,7 @@ TEST_F(ArrayTest, Serialization_ArrayOfPOD) {
FixedBufferForTesting buf(size);
Array_Data<int32_t>* data;
ArrayValidateParams validate_params(0, false, nullptr);
- SerializeArray_(array.Pass(), &buf, &data, &validate_params);
+ SerializeArray_(std::move(array), &buf, &data, &validate_params);
Array<int32_t> array2;
Deserialize_(data, &array2, nullptr);
@@ -171,7 +173,7 @@ TEST_F(ArrayTest, Serialization_EmptyArrayOfPOD) {
FixedBufferForTesting buf(size);
Array_Data<int32_t>* data;
ArrayValidateParams validate_params(0, false, nullptr);
- SerializeArray_(array.Pass(), &buf, &data, &validate_params);
+ SerializeArray_(std::move(array), &buf, &data, &validate_params);
Array<int32_t> array2;
Deserialize_(data, &array2, nullptr);
@@ -184,7 +186,7 @@ TEST_F(ArrayTest, Serialization_ArrayOfArrayOfPOD) {
Array<int32_t> inner(4);
for (size_t i = 0; i < inner.size(); ++i)
inner[i] = static_cast<int32_t>(i + (j * 10));
- array[j] = inner.Pass();
+ array[j] = std::move(inner);
}
size_t size = GetSerializedSize_(array);
@@ -194,7 +196,7 @@ TEST_F(ArrayTest, Serialization_ArrayOfArrayOfPOD) {
Array_Data<Array_Data<int32_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<Array<int32_t>> array2;
Deserialize_(data, &array2, nullptr);
@@ -219,7 +221,7 @@ TEST_F(ArrayTest, Serialization_ArrayOfBool) {
FixedBufferForTesting buf(size);
Array_Data<bool>* data;
ArrayValidateParams validate_params(0, false, nullptr);
- SerializeArray_(array.Pass(), &buf, &data, &validate_params);
+ SerializeArray_(std::move(array), &buf, &data, &validate_params);
Array<bool> array2;
Deserialize_(data, &array2, nullptr);
@@ -247,7 +249,7 @@ TEST_F(ArrayTest, Serialization_ArrayOfString) {
Array_Data<String_Data*>* 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<String> array2;
Deserialize_(data, &array2, nullptr);
@@ -407,7 +409,7 @@ TEST_F(ArrayTest, PushBack_MoveOnly) {
for (size_t i = 0; i < capacity; i++) {
MoveOnlyType value;
value_ptrs.push_back(value.ptr());
- array.push_back(value.Pass());
+ array.push_back(std::move(value));
ASSERT_EQ(i + 1, array.size());
ASSERT_EQ(i + 1, value_ptrs.size());
EXPECT_EQ(array.size() + 1, MoveOnlyType::num_instances());
@@ -419,7 +421,7 @@ TEST_F(ArrayTest, PushBack_MoveOnly) {
{
MoveOnlyType value;
value_ptrs.push_back(value.ptr());
- array.push_back(value.Pass());
+ array.push_back(std::move(value));
EXPECT_EQ(array.size() + 1, MoveOnlyType::num_instances());
}
ASSERT_EQ(capacity + 1, array.size());

Powered by Google App Engine
This is Rietveld 408576698