Commit 35c94025 authored by Ben Chan's avatar Ben Chan Committed by Commit Bot

chromeos: disks: replace base::MakeUnique with std::make_unique

Bug: 755727
Change-Id: Ie1ced7f1979392dde03eb81eaf0e9aa5aa0e0916
Reviewed-on: https://chromium-review.googlesource.com/721873Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#509237}
parent 0771c29b
...@@ -5,8 +5,9 @@ ...@@ -5,8 +5,9 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#include <memory>
#include "base/bind.h" #include "base/bind.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/strings/stringprintf.h" #include "base/strings/stringprintf.h"
#include "base/test/scoped_task_environment.h" #include "base/test/scoped_task_environment.h"
...@@ -15,7 +16,6 @@ ...@@ -15,7 +16,6 @@
#include "chromeos/disks/disk_mount_manager.h" #include "chromeos/disks/disk_mount_manager.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
using base::MakeUnique;
using base::StringPrintf; using base::StringPrintf;
using chromeos::disks::DiskMountManager; using chromeos::disks::DiskMountManager;
using chromeos::CrosDisksClient; using chromeos::CrosDisksClient;
...@@ -331,26 +331,28 @@ class MockDiskMountManagerObserver : public DiskMountManager::Observer { ...@@ -331,26 +331,28 @@ class MockDiskMountManagerObserver : public DiskMountManager::Observer {
// Mock notify methods. // Mock notify methods.
void OnDeviceEvent(DiskMountManager::DeviceEvent event, void OnDeviceEvent(DiskMountManager::DeviceEvent event,
const std::string& device_path) override { const std::string& device_path) override {
events_.push_back(MakeUnique<DeviceEvent>(event, device_path)); events_.push_back(std::make_unique<DeviceEvent>(event, device_path));
} }
void OnDiskEvent(DiskMountManager::DiskEvent event, void OnDiskEvent(DiskMountManager::DiskEvent event,
const DiskMountManager::Disk* disk) override { const DiskMountManager::Disk* disk) override {
// Take a snapshot (copy) of the Disk object at the time of invocation for // Take a snapshot (copy) of the Disk object at the time of invocation for
// later verification. // later verification.
events_.push_back(MakeUnique<DiskEvent>(event, *disk)); events_.push_back(std::make_unique<DiskEvent>(event, *disk));
} }
void OnFormatEvent(DiskMountManager::FormatEvent event, void OnFormatEvent(DiskMountManager::FormatEvent event,
chromeos::FormatError error_code, chromeos::FormatError error_code,
const std::string& device_path) override { const std::string& device_path) override {
events_.push_back(MakeUnique<FormatEvent>(event, error_code, device_path)); events_.push_back(
std::make_unique<FormatEvent>(event, error_code, device_path));
} }
void OnRenameEvent(DiskMountManager::RenameEvent event, void OnRenameEvent(DiskMountManager::RenameEvent event,
chromeos::RenameError error_code, chromeos::RenameError error_code,
const std::string& device_path) override { const std::string& device_path) override {
events_.push_back(MakeUnique<RenameEvent>(event, error_code, device_path)); events_.push_back(
std::make_unique<RenameEvent>(event, error_code, device_path));
} }
void OnMountEvent( void OnMountEvent(
...@@ -359,7 +361,7 @@ class MockDiskMountManagerObserver : public DiskMountManager::Observer { ...@@ -359,7 +361,7 @@ class MockDiskMountManagerObserver : public DiskMountManager::Observer {
const DiskMountManager::MountPointInfo& mount_point) override { const DiskMountManager::MountPointInfo& mount_point) override {
// Take a snapshot (copy) of a Disk object at the time of invocation. // Take a snapshot (copy) of a Disk object at the time of invocation.
// It can be verified later besides the arguments. // It can be verified later besides the arguments.
events_.push_back(MakeUnique<MountEvent>( events_.push_back(std::make_unique<MountEvent>(
event, error_code, mount_point, event, error_code, mount_point,
*manager_->disks().find(mount_point.source_path)->second)); *manager_->disks().find(mount_point.source_path)->second));
} }
...@@ -509,7 +511,7 @@ class DiskMountManagerTest : public testing::Test { ...@@ -509,7 +511,7 @@ class DiskMountManagerTest : public testing::Test {
// Adds a new disk to the disk mount manager. // Adds a new disk to the disk mount manager.
void AddTestDisk(const TestDiskInfo& disk) { void AddTestDisk(const TestDiskInfo& disk) {
EXPECT_TRUE(DiskMountManager::GetInstance()->AddDiskForTest( EXPECT_TRUE(DiskMountManager::GetInstance()->AddDiskForTest(
base::MakeUnique<DiskMountManager::Disk>( std::make_unique<DiskMountManager::Disk>(
disk.source_path, disk.mount_path, disk.write_disabled_by_policy, disk.source_path, disk.mount_path, disk.write_disabled_by_policy,
disk.system_path, disk.file_path, disk.device_label, disk.system_path, disk.file_path, disk.device_label,
disk.drive_label, disk.vendor_id, disk.vendor_name, disk.product_id, disk.drive_label, disk.vendor_id, disk.vendor_name, disk.product_id,
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <memory> #include <memory>
#include <utility> #include <utility>
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
...@@ -72,7 +71,7 @@ MockDiskMountManager::~MockDiskMountManager() { ...@@ -72,7 +71,7 @@ MockDiskMountManager::~MockDiskMountManager() {
void MockDiskMountManager::NotifyDeviceInsertEvents() { void MockDiskMountManager::NotifyDeviceInsertEvents() {
std::unique_ptr<DiskMountManager::Disk> disk1_ptr = std::unique_ptr<DiskMountManager::Disk> disk1_ptr =
base::MakeUnique<DiskMountManager::Disk>( std::make_unique<DiskMountManager::Disk>(
std::string(kTestDevicePath), std::string(), std::string(kTestDevicePath), std::string(),
false, // write_disabled_by_policy false, // write_disabled_by_policy
std::string(kTestSystemPath), std::string(kTestFilePath), std::string(kTestSystemPath), std::string(kTestFilePath),
...@@ -101,7 +100,7 @@ void MockDiskMountManager::NotifyDeviceInsertEvents() { ...@@ -101,7 +100,7 @@ void MockDiskMountManager::NotifyDeviceInsertEvents() {
// Disk Changed // Disk Changed
std::unique_ptr<DiskMountManager::Disk> disk2_ptr = std::unique_ptr<DiskMountManager::Disk> disk2_ptr =
base::MakeUnique<DiskMountManager::Disk>( std::make_unique<DiskMountManager::Disk>(
std::string(kTestDevicePath), std::string(kTestMountPath), std::string(kTestDevicePath), std::string(kTestMountPath),
false, // write_disabled_by_policy false, // write_disabled_by_policy
std::string(kTestSystemPath), std::string(kTestFilePath), std::string(kTestSystemPath), std::string(kTestFilePath),
...@@ -125,7 +124,7 @@ void MockDiskMountManager::NotifyDeviceInsertEvents() { ...@@ -125,7 +124,7 @@ void MockDiskMountManager::NotifyDeviceInsertEvents() {
void MockDiskMountManager::NotifyDeviceRemoveEvents() { void MockDiskMountManager::NotifyDeviceRemoveEvents() {
std::unique_ptr<DiskMountManager::Disk> disk_ptr = std::unique_ptr<DiskMountManager::Disk> disk_ptr =
base::MakeUnique<DiskMountManager::Disk>( std::make_unique<DiskMountManager::Disk>(
std::string(kTestDevicePath), std::string(kTestMountPath), std::string(kTestDevicePath), std::string(kTestMountPath),
false, // write_disabled_by_policy false, // write_disabled_by_policy
std::string(kTestSystemPath), std::string(kTestFilePath), std::string(kTestSystemPath), std::string(kTestFilePath),
...@@ -183,7 +182,7 @@ void MockDiskMountManager::CreateDiskEntryForMountDevice( ...@@ -183,7 +182,7 @@ void MockDiskMountManager::CreateDiskEntryForMountDevice(
bool on_removable_device, bool on_removable_device,
const std::string& file_system_type) { const std::string& file_system_type) {
std::unique_ptr<DiskMountManager::Disk> disk_ptr = std::unique_ptr<DiskMountManager::Disk> disk_ptr =
base::MakeUnique<DiskMountManager::Disk>( std::make_unique<DiskMountManager::Disk>(
mount_info.source_path, mount_info.mount_path, mount_info.source_path, mount_info.mount_path,
false, // write_disabled_by_policy false, // write_disabled_by_policy
std::string(), // system_path std::string(), // system_path
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment