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

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

Issue 1353683005: EDK: Convert remaining scoped_ptr -> std::unique_ptr in //mojo/edk/system. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 3 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 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/remote_consumer_data_pipe_impl.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 b576f5312a2cf7c77e33abb5a5c3187409b11451..3a5160b696214e032c715b90c41baecef5b1e91b 100644
--- a/mojo/edk/system/raw_channel_unittest.cc
+++ b/mojo/edk/system/raw_channel_unittest.cc
@@ -7,12 +7,13 @@
#include <stdint.h>
#include <stdio.h>
+#include <memory>
+#include <utility>
#include <vector>
#include "base/bind.h"
#include "base/location.h"
#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/simple_thread.h"
@@ -35,14 +36,14 @@ namespace mojo {
namespace system {
namespace {
-scoped_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) {
+std::unique_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) {
std::vector<unsigned char> bytes(num_bytes, 0);
for (size_t i = 0; i < num_bytes; i++)
bytes[i] = static_cast<unsigned char>(i + num_bytes);
- return make_scoped_ptr(
- new MessageInTransit(MessageInTransit::Type::ENDPOINT_CLIENT,
- MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA,
- num_bytes, bytes.empty() ? nullptr : &bytes[0]));
+ return util::MakeUnique<MessageInTransit>(
+ MessageInTransit::Type::ENDPOINT_CLIENT,
+ MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA, num_bytes,
+ bytes.empty() ? nullptr : &bytes[0]);
}
bool CheckMessageData(const void* bytes, uint32_t num_bytes) {
@@ -60,7 +61,7 @@ void InitOnIOThread(RawChannel* raw_channel, RawChannel::Delegate* delegate) {
bool WriteTestMessageToHandle(const embedder::PlatformHandle& handle,
uint32_t num_bytes) {
- scoped_ptr<MessageInTransit> message(MakeTestMessage(num_bytes));
+ std::unique_ptr<MessageInTransit> message(MakeTestMessage(num_bytes));
size_t write_size = 0;
mojo::test::BlockingWrite(handle, message->main_buffer(),
@@ -821,13 +822,13 @@ TEST_F(RawChannelTest, ReadWritePlatformHandles) {
platform_handles->push_back(
mojo::test::PlatformHandleFromFILE(fp2.Pass()).release());
- scoped_ptr<MessageInTransit> message(
+ std::unique_ptr<MessageInTransit> message(
new MessageInTransit(MessageInTransit::Type::ENDPOINT_CLIENT,
MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA,
sizeof(kHello), kHello));
message->SetTransportData(util::MakeUnique<TransportData>(
platform_handles.Pass(), rc_write->GetSerializedPlatformHandleSize()));
- EXPECT_TRUE(rc_write->WriteMessage(message.Pass()));
+ 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/remote_consumer_data_pipe_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698