Chromium Code Reviews| Index: components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc |
| diff --git a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc |
| index e5ba32cecb6cc3bb15e21e5956e43d715e17135f..1d74d553c249364828b8db7ca3a0fddbcbf86159 100644 |
| --- a/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc |
| +++ b/components/proximity_auth/ble/bluetooth_low_energy_connection_finder_unittest.cc |
| @@ -4,13 +4,14 @@ |
| #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h" |
| +#include <memory> |
| #include <string> |
| #include <utility> |
| #include "base/bind.h" |
| #include "base/macros.h" |
| +#include "base/memory/ptr_util.h" |
| #include "base/memory/ref_counted.h" |
| -#include "base/memory/scoped_ptr.h" |
| #include "base/message_loop/message_loop.h" |
| #include "base/run_loop.h" |
| #include "base/strings/utf_string_conversions.h" |
| @@ -69,7 +70,8 @@ class MockBluetoothLowEnergyConnectionFinder |
| ~MockBluetoothLowEnergyConnectionFinder() override {} |
| - // Mock methods don't support return type scoped_ptr<>. This is a possible |
| + // Mock methods don't support return type std::unique_ptr<>. This is a |
| + // possible |
| // workaround: mock a proxy method to be called by the target overrided method |
| // (CreateConnection). |
|
Ilya Sherman
2016/04/20 22:08:56
Also, is this comment still true?
Ilya Sherman
2016/04/20 22:08:56
nit: Please rewrap
dcheng
2016/04/20 22:13:52
Done.
(Also, yes, this comment is still true.)
|
| MOCK_METHOD0(CreateConnectionProxy, Connection*()); |
| @@ -80,7 +82,7 @@ class MockBluetoothLowEnergyConnectionFinder |
| // NOTE: The returned connection's lifetime is managed by the connection |
| // finder. |
| FakeConnection* ExpectCreateConnection() { |
| - scoped_ptr<FakeConnection> connection( |
| + std::unique_ptr<FakeConnection> connection( |
| new FakeConnection(CreateLERemoteDeviceForTest())); |
| FakeConnection* connection_alias = connection.get(); |
| EXPECT_CALL(*this, CreateConnectionProxy()) |
| @@ -91,9 +93,9 @@ class MockBluetoothLowEnergyConnectionFinder |
| MOCK_METHOD0(CloseGattConnectionProxy, void(void)); |
| protected: |
| - scoped_ptr<Connection> CreateConnection( |
| + std::unique_ptr<Connection> CreateConnection( |
| const std::string& device_address) override { |
| - return make_scoped_ptr(CreateConnectionProxy()); |
| + return base::WrapUnique(CreateConnectionProxy()); |
| } |
| private: |
| @@ -132,14 +134,14 @@ class ProximityAuthBluetoothLowEnergyConnectionFinderTest |
| .WillByDefault(Return(false)); |
| } |
| - void OnConnectionFound(scoped_ptr<Connection> connection) { |
| + void OnConnectionFound(std::unique_ptr<Connection> connection) { |
| last_found_connection_ = std::move(connection); |
| } |
| void FindAndExpectStartDiscovery( |
| BluetoothLowEnergyConnectionFinder& connection_finder) { |
| device::BluetoothAdapter::DiscoverySessionCallback discovery_callback; |
| - scoped_ptr<device::MockBluetoothDiscoverySession> discovery_session( |
| + std::unique_ptr<device::MockBluetoothDiscoverySession> discovery_session( |
| new NiceMock<device::MockBluetoothDiscoverySession>()); |
| last_discovery_session_alias_ = discovery_session.get(); |
| @@ -172,9 +174,9 @@ class ProximityAuthBluetoothLowEnergyConnectionFinderTest |
| scoped_refptr<device::MockBluetoothAdapter> adapter_; |
| ConnectionFinder::ConnectionCallback connection_callback_; |
| - scoped_ptr<device::MockBluetoothDevice> device_; |
| - scoped_ptr<Connection> last_found_connection_; |
| - scoped_ptr<MockBluetoothLowEnergyDeviceWhitelist> device_whitelist_; |
| + std::unique_ptr<device::MockBluetoothDevice> device_; |
| + std::unique_ptr<Connection> last_found_connection_; |
| + std::unique_ptr<MockBluetoothLowEnergyDeviceWhitelist> device_whitelist_; |
| device::MockBluetoothDiscoverySession* last_discovery_session_alias_; |
| private: |
| @@ -211,7 +213,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyConnectionFinderTest, |
| device_whitelist_.get(), nullptr, kMaxNumberOfAttempts); |
| device::BluetoothAdapter::DiscoverySessionCallback discovery_callback; |
| - scoped_ptr<device::MockBluetoothDiscoverySession> discovery_session( |
| + std::unique_ptr<device::MockBluetoothDiscoverySession> discovery_session( |
| new NiceMock<device::MockBluetoothDiscoverySession>()); |
| device::MockBluetoothDiscoverySession* discovery_session_alias = |
| discovery_session.get(); |
| @@ -413,7 +415,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyConnectionFinderTest, |
| } |
| // Restarting the discovery session. |
| - scoped_ptr<device::MockBluetoothDiscoverySession> discovery_session( |
| + std::unique_ptr<device::MockBluetoothDiscoverySession> discovery_session( |
| new NiceMock<device::MockBluetoothDiscoverySession>()); |
| last_discovery_session_alias_ = discovery_session.get(); |
| ON_CALL(*last_discovery_session_alias_, IsActive()) |
| @@ -460,7 +462,7 @@ TEST_F(ProximityAuthBluetoothLowEnergyConnectionFinderTest, |
| ON_CALL(*adapter_, IsPowered()).WillByDefault(Return(true)); |
| device::BluetoothAdapter::DiscoverySessionCallback discovery_callback; |
| - scoped_ptr<device::MockBluetoothDiscoverySession> discovery_session( |
| + std::unique_ptr<device::MockBluetoothDiscoverySession> discovery_session( |
| new NiceMock<device::MockBluetoothDiscoverySession>()); |
| last_discovery_session_alias_ = discovery_session.get(); |