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

Unified Diff: device/bluetooth/bluez/bluetooth_service_attribute_value_bluez_unittest.cc

Issue 2287023002: device/bluetooth: Fix = operator and copy constructor of BluetoothServiceAttributeValueBlueZ (Closed)
Patch Set: change bug number 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/bluez/bluetooth_service_attribute_value_bluez.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « device/bluetooth/bluez/bluetooth_service_attribute_value_bluez.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698