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

Unified Diff: device/bluetooth/bluetooth_device_unittest.cc

Issue 1412963004: bluetooth: android: Implement Characteristic GetIdentifier, fix Service IDs too. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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_device_unittest.cc
diff --git a/device/bluetooth/bluetooth_device_unittest.cc b/device/bluetooth/bluetooth_device_unittest.cc
index 6a2f2613a86ced036773ccfe3ab033048e0d2eeb..8015f21573085c5de9b053eda21479c4d3cc0617 100644
--- a/device/bluetooth/bluetooth_device_unittest.cc
+++ b/device/bluetooth/bluetooth_device_unittest.cc
@@ -7,6 +7,7 @@
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/strings/utf_string_conversions.h"
+#include "device/bluetooth/bluetooth_gatt_service.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_ANDROID)
@@ -426,7 +427,7 @@ TEST_F(BluetoothTest, BluetoothGattConnection_ErrorAfterConnection) {
#endif // defined(OS_ANDROID)
#if defined(OS_ANDROID)
-TEST_F(BluetoothTest, SimulateGattServicesDiscovered) {
+TEST_F(BluetoothTest, GetGattServices_and_GetGattService) {
InitWithFakeAdapter();
StartLowEnergyDiscoverySession();
BluetoothDevice* device = DiscoverLowEnergyDevice(3);
@@ -443,11 +444,19 @@ TEST_F(BluetoothTest, SimulateGattServicesDiscovered) {
services.push_back("00000001-0000-1000-8000-00805f9b34fb");
SimulateGattServicesDiscovered(device, services);
EXPECT_EQ(3u, device->GetGattServices().size());
+
+ // Test GetGattService:
+ std::string service_id1 = device->GetGattServices()[0]->GetIdentifier();
+ std::string service_id2 = device->GetGattServices()[1]->GetIdentifier();
+ std::string service_id3 = device->GetGattServices()[2]->GetIdentifier();
+ EXPECT_TRUE(device->GetGattService(service_id1));
+ EXPECT_TRUE(device->GetGattService(service_id2));
+ EXPECT_TRUE(device->GetGattService(service_id3));
}
#endif // defined(OS_ANDROID)
#if defined(OS_ANDROID)
-TEST_F(BluetoothTest, SimulateGattServicesDiscoveryError) {
+TEST_F(BluetoothTest, GetGattServices_DiscoveryError) {
InitWithFakeAdapter();
StartLowEnergyDiscoverySession();
BluetoothDevice* device = DiscoverLowEnergyDevice(3);

Powered by Google App Engine
This is Rietveld 408576698