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

Unified Diff: device/bluetooth/bluetooth_adapter_unittest.cc

Issue 1544323002: Convert Pass()→std::move() in //device (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 | « device/bluetooth/bluetooth_adapter_profile_bluez.cc ('k') | device/bluetooth/bluetooth_advertisement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/bluetooth_adapter_unittest.cc
diff --git a/device/bluetooth/bluetooth_adapter_unittest.cc b/device/bluetooth/bluetooth_adapter_unittest.cc
index 9cff2e42d9ce1c4ac31640ec705986c68e034e52..6bc24c3ac1c19446a69fcc8a0162a379f2cd5660 100644
--- a/device/bluetooth/bluetooth_adapter_unittest.cc
+++ b/device/bluetooth/bluetooth_adapter_unittest.cc
@@ -2,14 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "device/bluetooth/bluetooth_adapter.h"
+
#include <stddef.h>
#include <stdint.h>
+#include <utility>
#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "build/build_config.h"
-#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_device.h"
#include "device/bluetooth/bluetooth_discovery_session.h"
#include "device/bluetooth/test/bluetooth_test.h"
@@ -61,7 +63,7 @@ class TestBluetoothAdapter : public BluetoothAdapter {
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter,
const DiscoverySessionCallback& callback,
const ErrorCallback& error_callback) override {
- OnStartDiscoverySession(discovery_filter.Pass(), callback);
+ OnStartDiscoverySession(std::move(discovery_filter), callback);
}
void StartDiscoverySession(const DiscoverySessionCallback& callback,
@@ -94,7 +96,7 @@ class TestBluetoothAdapter : public BluetoothAdapter {
void TestOnStartDiscoverySession(
scoped_ptr<device::BluetoothDiscoverySession> discovery_session) {
- discovery_sessions_.push_back(discovery_session.Pass());
+ discovery_sessions_.push_back(std::move(discovery_session));
}
void CleanupSessions() { discovery_sessions_.clear(); }
@@ -102,7 +104,7 @@ class TestBluetoothAdapter : public BluetoothAdapter {
void InjectFilteredSession(
scoped_ptr<device::BluetoothDiscoveryFilter> discovery_filter) {
StartDiscoverySessionWithFilter(
- discovery_filter.Pass(),
+ std::move(discovery_filter),
base::Bind(&TestBluetoothAdapter::TestOnStartDiscoverySession,
base::Unretained(this)),
base::Bind(&TestBluetoothAdapter::TestErrorCallback,
@@ -226,7 +228,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRegular) {
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter;
// make sure adapter have one session wihout filtering.
- adapter->InjectFilteredSession(discovery_filter.Pass());
+ adapter->InjectFilteredSession(std::move(discovery_filter));
// having one reglar session should result in no filter
scoped_ptr<BluetoothDiscoveryFilter> resulting_filter =
@@ -257,7 +259,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRssi) {
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter2(df2);
// make sure adapter have one session wihout filtering.
- adapter->InjectFilteredSession(discovery_filter.Pass());
+ adapter->InjectFilteredSession(std::move(discovery_filter));
// DO_NOTHING should have no impact
resulting_filter = adapter->GetMergedDiscoveryFilter();
@@ -269,7 +271,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRssi) {
resulting_filter->GetRSSI(&resulting_rssi);
EXPECT_EQ(-30, resulting_rssi);
- adapter->InjectFilteredSession(discovery_filter2.Pass());
+ adapter->InjectFilteredSession(std::move(discovery_filter2));
// result of merging two rssi values should be lower one
resulting_filter = adapter->GetMergedDiscoveryFilter();
@@ -293,7 +295,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterRssi) {
// when rssi and pathloss are merged, both should be cleared, becuase there is
// no way to tell which filter will be more generic
- adapter->InjectFilteredSession(discovery_filter3.Pass());
+ adapter->InjectFilteredSession(std::move(discovery_filter3));
resulting_filter = adapter->GetMergedDiscoveryFilter();
EXPECT_FALSE(resulting_filter->GetRSSI(&resulting_rssi));
EXPECT_FALSE(resulting_filter->GetPathloss(&resulting_pathloss));
@@ -313,14 +315,14 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterTransport) {
BluetoothDiscoveryFilter::Transport::TRANSPORT_LE);
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter2(df2);
- adapter->InjectFilteredSession(discovery_filter.Pass());
+ adapter->InjectFilteredSession(std::move(discovery_filter));
// Just one filter, make sure transport was properly rewritten
resulting_filter = adapter->GetMergedDiscoveryFilter();
EXPECT_EQ(BluetoothDiscoveryFilter::Transport::TRANSPORT_CLASSIC,
resulting_filter->GetTransport());
- adapter->InjectFilteredSession(discovery_filter2.Pass());
+ adapter->InjectFilteredSession(std::move(discovery_filter2));
// Two filters, should have OR of both transport's
resulting_filter = adapter->GetMergedDiscoveryFilter();
@@ -344,7 +346,7 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterTransport) {
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter3(df3);
// Merging empty filter in should result in empty filter
- adapter->InjectFilteredSession(discovery_filter3.Pass());
+ adapter->InjectFilteredSession(std::move(discovery_filter3));
resulting_filter = adapter->GetMergedDiscoveryFilter();
EXPECT_TRUE(resulting_filter->IsDefault());
@@ -379,9 +381,9 @@ TEST(BluetoothAdapterTest, GetMergedDiscoveryFilterAllFields) {
scoped_ptr<BluetoothDiscoveryFilter> discovery_filter3(df3);
// make sure adapter have one session wihout filtering.
- adapter->InjectFilteredSession(discovery_filter.Pass());
- adapter->InjectFilteredSession(discovery_filter2.Pass());
- adapter->InjectFilteredSession(discovery_filter3.Pass());
+ adapter->InjectFilteredSession(std::move(discovery_filter));
+ adapter->InjectFilteredSession(std::move(discovery_filter2));
+ adapter->InjectFilteredSession(std::move(discovery_filter3));
scoped_ptr<BluetoothDiscoveryFilter> resulting_filter =
adapter->GetMergedDiscoveryFilter();
« no previous file with comments | « device/bluetooth/bluetooth_adapter_profile_bluez.cc ('k') | device/bluetooth/bluetooth_advertisement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698