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

Unified Diff: device/bluetooth/test/mock_bluetooth_device.cc

Issue 2196883002: bluetooth: Add optional 'name' support to MockBluetoothDevice. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « device/bluetooth/test/mock_bluetooth_device.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/test/mock_bluetooth_device.cc
diff --git a/device/bluetooth/test/mock_bluetooth_device.cc b/device/bluetooth/test/mock_bluetooth_device.cc
index 891c9cf803b8952193acf414a02dd1eb5bda2deb..39d27c82c606a4f1fd1079d85a96dff6daacf587 100644
--- a/device/bluetooth/test/mock_bluetooth_device.cc
+++ b/device/bluetooth/test/mock_bluetooth_device.cc
@@ -15,13 +15,13 @@ namespace device {
MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter,
uint32_t bluetooth_class,
- const std::string& name,
+ const char* name,
const std::string& address,
bool paired,
bool connected)
: BluetoothDevice(adapter),
bluetooth_class_(bluetooth_class),
- name_(name),
+ name_(name ? base::Optional<std::string>(name) : base::nullopt),
address_(address),
connected_(connected) {
ON_CALL(*this, GetBluetoothClass())
@@ -38,10 +38,10 @@ MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter,
.WillByDefault(testing::Return(0));
ON_CALL(*this, GetDeviceID())
.WillByDefault(testing::Return(0));
- ON_CALL(*this, GetName())
- .WillByDefault(testing::Return(base::make_optional(name_)));
+ ON_CALL(*this, GetName()).WillByDefault(testing::Return(name_));
ON_CALL(*this, GetNameForDisplay())
- .WillByDefault(testing::Return(base::UTF8ToUTF16(name_)));
+ .WillByDefault(testing::Return(
+ base::UTF8ToUTF16(name_ ? name_.value() : "Unnamed Device")));
ON_CALL(*this, GetDeviceType())
.WillByDefault(testing::Return(DEVICE_UNKNOWN));
ON_CALL(*this, IsPaired())
« no previous file with comments | « device/bluetooth/test/mock_bluetooth_device.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698