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..4db5190d81d23909377b28926ca2b798948eaec4 |
--- /dev/null |
+++ b/device/bluetooth/bluetooth_gatt_service_unittest.cc |
@@ -0,0 +1,39 @@ |
+// 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, GetUUID) { |
+ InitWithFakeAdapter(); |
+ StartDiscoverySession(); |
+ BluetoothDevice* device = DiscoverLowEnergyDevice(3); |
+ device->CreateGattConnection(GetGattConnectionCallback(), |
+ GetConnectErrorCallback()); |
+ ResetEventCounts(); |
+ SimulateGattConnection(device); |
+ EXPECT_EQ(1, gatt_discovery_attempts_); |
+ |
+ // Create multiple instances, verifying each can have 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); |
+ EXPECT_EQ(uuid, device->GetGattServices()[0]->GetUUID()); |
Jeffrey Yasskin
2015/10/15 23:48:30
Also assert their instance IDs are distinct?
scheib
2015/10/16 00:23:36
Done.
|
+ EXPECT_EQ(uuid, device->GetGattServices()[1]->GetUUID()); |
+} |
+#endif // defined(OS_ANDROID) |
+ |
+} // namespace device |