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

Unified Diff: mojo/edk/system/raw_channel_unittest.cc

Issue 1529303004: Convert Pass()→std::move() in mojo/edk/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « mojo/edk/system/raw_channel_posix.cc ('k') | mojo/edk/system/routed_raw_channel.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/raw_channel_unittest.cc
diff --git a/mojo/edk/system/raw_channel_unittest.cc b/mojo/edk/system/raw_channel_unittest.cc
index c2298d61568a40ea2116ce6b2ae72135816ccd22..8690bb8e0655ba0bba65fa1bf09df5bcb0a1b288 100644
--- a/mojo/edk/system/raw_channel_unittest.cc
+++ b/mojo/edk/system/raw_channel_unittest.cc
@@ -6,7 +6,7 @@
#include <stdint.h>
#include <stdio.h>
-
+#include <utility>
#include <vector>
#include "base/bind.h"
@@ -197,7 +197,7 @@ class TestMessageReaderAndChecker {
// Tests writing (and verifies reading using our own custom reader).
TEST_F(RawChannelTest, WriteMessage) {
WriteOnlyRawChannelDelegate delegate;
- RawChannel* rc = RawChannel::Create(handles[0].Pass());
+ RawChannel* rc = RawChannel::Create(std::move(handles[0]));
TestMessageReaderAndChecker checker(handles[1].get());
internal::g_io_thread_task_runner->PostTask(
FROM_HERE,
@@ -283,7 +283,7 @@ class ReadCheckerRawChannelDelegate : public RawChannel::Delegate {
// Tests reading (writing using our own custom writer).
TEST_F(RawChannelTest, OnReadMessage) {
ReadCheckerRawChannelDelegate delegate;
- RawChannel* rc = RawChannel::Create(handles[0].Pass());
+ RawChannel* rc = RawChannel::Create(std::move(handles[0]));
internal::g_io_thread_task_runner->PostTask(
FROM_HERE,
base::Bind(&InitOnIOThread, rc, base::Unretained(&delegate)));
@@ -380,7 +380,7 @@ TEST_F(RawChannelTest, WriteMessageAndOnReadMessage) {
static const size_t kNumWriteMessagesPerThread = 400;
WriteOnlyRawChannelDelegate writer_delegate;
- RawChannel* writer_rc = RawChannel::Create(handles[0].Pass());
+ RawChannel* writer_rc = RawChannel::Create(std::move(handles[0]));
internal::g_io_thread_task_runner->PostTask(
FROM_HERE,
base::Bind(&InitOnIOThread, writer_rc,
@@ -388,7 +388,7 @@ TEST_F(RawChannelTest, WriteMessageAndOnReadMessage) {
ReadCountdownRawChannelDelegate reader_delegate(kNumWriterThreads *
kNumWriteMessagesPerThread);
- RawChannel* reader_rc = RawChannel::Create(handles[1].Pass());
+ RawChannel* reader_rc = RawChannel::Create(std::move(handles[1]));
internal::g_io_thread_task_runner->PostTask(
FROM_HERE,
base::Bind(&InitOnIOThread, reader_rc,
@@ -479,7 +479,7 @@ class ErrorRecordingRawChannelDelegate
// Tests (fatal) errors.
TEST_F(RawChannelTest, OnError) {
ErrorRecordingRawChannelDelegate delegate(0, true, true);
- RawChannel* rc = RawChannel::Create(handles[0].Pass());
+ RawChannel* rc = RawChannel::Create(std::move(handles[0]));
internal::g_io_thread_task_runner->PostTask(
FROM_HERE,
base::Bind(&InitOnIOThread, rc, base::Unretained(&delegate)));
@@ -523,7 +523,7 @@ TEST_F(RawChannelTest, ReadUnaffectedByWriteError) {
// Only start up reading here. The system buffer should still contain the
// messages that were written.
ErrorRecordingRawChannelDelegate delegate(kMessageCount, true, true);
- RawChannel* rc = RawChannel::Create(handles[0].Pass());
+ RawChannel* rc = RawChannel::Create(std::move(handles[0]));
internal::g_io_thread_task_runner->PostTask(
FROM_HERE,
base::Bind(&InitOnIOThread, rc, base::Unretained(&delegate)));
@@ -572,7 +572,7 @@ class ReadPlatformHandlesCheckerRawChannelDelegate
{
char buffer[100] = {};
- base::ScopedFILE fp(test::FILEFromPlatformHandle(h1.Pass(), "rb"));
+ base::ScopedFILE fp(test::FILEFromPlatformHandle(std::move(h1), "rb"));
EXPECT_TRUE(fp);
rewind(fp.get());
EXPECT_EQ(1u, fread(buffer, 1, sizeof(buffer), fp.get()));
@@ -581,7 +581,7 @@ class ReadPlatformHandlesCheckerRawChannelDelegate
{
char buffer[100] = {};
- base::ScopedFILE fp(test::FILEFromPlatformHandle(h2.Pass(), "rb"));
+ base::ScopedFILE fp(test::FILEFromPlatformHandle(std::move(h2), "rb"));
EXPECT_TRUE(fp);
rewind(fp.get());
EXPECT_EQ(1u, fread(buffer, 1, sizeof(buffer), fp.get()));
@@ -608,13 +608,13 @@ TEST_F(RawChannelTest, ReadWritePlatformHandles) {
ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
WriteOnlyRawChannelDelegate write_delegate;
- RawChannel* rc_write = RawChannel::Create(handles[0].Pass());
+ RawChannel* rc_write = RawChannel::Create(std::move(handles[0]));
internal::g_io_thread_task_runner->PostTask(
FROM_HERE,
base::Bind(&InitOnIOThread, rc_write, base::Unretained(&write_delegate)));
ReadPlatformHandlesCheckerRawChannelDelegate read_delegate;
- RawChannel* rc_read = RawChannel::Create(handles[1].Pass());
+ RawChannel* rc_read = RawChannel::Create(std::move(handles[1]));
internal::g_io_thread_task_runner->PostTask(
FROM_HERE,
base::Bind(&InitOnIOThread, rc_read, base::Unretained(&read_delegate)));
@@ -631,16 +631,17 @@ TEST_F(RawChannelTest, ReadWritePlatformHandles) {
const char kHello[] = "hello";
ScopedPlatformHandleVectorPtr platform_handles(new PlatformHandleVector());
platform_handles->push_back(
- test::PlatformHandleFromFILE(fp1.Pass()).release());
+ test::PlatformHandleFromFILE(std::move(fp1)).release());
platform_handles->push_back(
- test::PlatformHandleFromFILE(fp2.Pass()).release());
+ test::PlatformHandleFromFILE(std::move(fp2)).release());
scoped_ptr<MessageInTransit> message(
new MessageInTransit(MessageInTransit::Type::MESSAGE,
sizeof(kHello), kHello));
- message->SetTransportData(make_scoped_ptr(new TransportData(
- platform_handles.Pass(), rc_write->GetSerializedPlatformHandleSize())));
- EXPECT_TRUE(rc_write->WriteMessage(message.Pass()));
+ message->SetTransportData(make_scoped_ptr(
+ new TransportData(std::move(platform_handles),
+ rc_write->GetSerializedPlatformHandleSize())));
+ EXPECT_TRUE(rc_write->WriteMessage(std::move(message)));
}
read_delegate.Wait();
« no previous file with comments | « mojo/edk/system/raw_channel_posix.cc ('k') | mojo/edk/system/routed_raw_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698