Index: device/bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc |
diff --git a/device/bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc b/device/bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc |
index e27cb523200e72e8cef7da13a27c9c772ff1b6b6..e61e6bb227331db67ea0067c824f4187dc63a8b8 100644 |
--- a/device/bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc |
+++ b/device/bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc |
@@ -5,6 +5,7 @@ |
#include "device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.h" |
#include <cstdint> |
+#include <string> |
#include "base/memory/ptr_util.h" |
#include "base/values.h" |
@@ -42,7 +43,8 @@ std::unique_ptr<Sequence> MakeSequence( |
const std::initializer_list<BluetoothServiceAttributeValueBlueZ> list) { |
return base::MakeUnique<Sequence>(list); |
} |
-} |
+ |
+} // namespace |
TEST(BluetoothServiceAttributeBlueZTest, BasicValue) { |
BluetoothServiceAttributeValueBlueZ value1( |
@@ -120,4 +122,29 @@ TEST(BluetoothServiceAttributeBlueZTest, NestedValue) { |
CheckIntValue(v31[1], 0x1337); |
} |
+TEST(BluetoothServiceAttributeBlueZTest, CopyAssignment) { |
+ BluetoothServiceAttributeValueBlueZ value1( |
+ Type::UUID, 16, base::MakeUnique<base::StringValue>(kServiceUuid)); |
+ BluetoothServiceAttributeValueBlueZ value2( |
+ Type::INT, 4, base::MakeUnique<base::FundamentalValue>(0x1337)); |
+ BluetoothServiceAttributeValueBlueZ value3( |
+ Type::INT, 4, base::MakeUnique<base::FundamentalValue>(0x7331)); |
+ std::unique_ptr<BluetoothServiceAttributeValueBlueZ> value4( |
+ new BluetoothServiceAttributeValueBlueZ( |
+ MakeSequence({value1, value2, value3}))); |
+ |
+ BluetoothServiceAttributeValueBlueZ value; |
+ |
+ value = *value4; |
+ value4 = nullptr; |
+ |
+ EXPECT_EQ(3u, value.size()); |
+ const Sequence& s = value.sequence(); |
+ EXPECT_EQ(3u, s.size()); |
+ |
+ CheckUuidValue(s[0], kServiceUuid); |
+ CheckIntValue(s[2], 0x7331); |
+ CheckIntValue(s[1], 0x1337); |
+} |
+ |
} // namespace bluez |