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

Unified Diff: device/bluetooth/bluetooth_gatt_service_unittest.cc

Issue 1395783005: bluetooth: android: BluetoothRemoteGattServiceAndroid::GetUUID (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed jyasskin comments Created 5 years, 2 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
Index: device/bluetooth/bluetooth_gatt_service_unittest.cc
diff --git a/device/bluetooth/bluetooth_gatt_service_unittest.cc b/device/bluetooth/bluetooth_gatt_service_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..91fd2141a7d46c8588145f5f97295e0b3af6fccf
--- /dev/null
+++ b/device/bluetooth/bluetooth_gatt_service_unittest.cc
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "device/bluetooth/bluetooth_gatt_service.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+#if defined(OS_ANDROID)
+#include "device/bluetooth/test/bluetooth_test_android.h"
+#elif defined(OS_MACOSX)
+#include "device/bluetooth/test/bluetooth_test_mac.h"
+#endif
+
+namespace device {
+
+#if defined(OS_ANDROID)
+TEST_F(BluetoothTest, GetUUIDAndGetIdentifier) {
+ InitWithFakeAdapter();
+ StartDiscoverySession();
+ BluetoothDevice* device = DiscoverLowEnergyDevice(3);
+ device->CreateGattConnection(GetGattConnectionCallback(),
+ GetConnectErrorCallback());
+ ResetEventCounts();
+ SimulateGattConnection(device);
+ EXPECT_EQ(1, gatt_discovery_attempts_);
+
+ // Create multiple instances with the same UUID.
+ BluetoothUUID uuid("00000000-0000-1000-8000-00805f9b34fb");
+ std::vector<std::string> services;
+ services.push_back(uuid.canonical_value());
+ services.push_back(uuid.canonical_value());
+ SimulateGattServicesDiscovered(device, services);
+
+ // Each has the same UUID.
+ EXPECT_EQ(uuid, device->GetGattServices()[0]->GetUUID());
+ EXPECT_EQ(uuid, device->GetGattServices()[1]->GetUUID());
+
+ // Instance IDs are unique.
+ EXPECT_NE(device->GetGattServices()[0]->GetIdentifier(),
+ device->GetGattServices()[1]->GetIdentifier());
+}
+#endif // defined(OS_ANDROID)
+
+} // namespace device
« no previous file with comments | « device/bluetooth/bluetooth_device_unittest.cc ('k') | device/bluetooth/bluetooth_remote_gatt_service_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698