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

Side by Side Diff: device/bluetooth/bluetooth_gatt_service_unittest.cc

Issue 1412023002: bluetooth: mac: Only test Low Energy discovery sessions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@btm-key-strings-
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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_gatt_service.h" 5 #include "device/bluetooth/bluetooth_gatt_service.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 #if defined(OS_ANDROID) 9 #if defined(OS_ANDROID)
10 #include "device/bluetooth/test/bluetooth_test_android.h" 10 #include "device/bluetooth/test/bluetooth_test_android.h"
11 #elif defined(OS_MACOSX) 11 #elif defined(OS_MACOSX)
12 #include "device/bluetooth/test/bluetooth_test_mac.h" 12 #include "device/bluetooth/test/bluetooth_test_mac.h"
13 #endif 13 #endif
14 14
15 namespace device { 15 namespace device {
16 16
17 #if defined(OS_ANDROID) 17 #if defined(OS_ANDROID)
18 TEST_F(BluetoothTest, GetUUIDAndGetIdentifier) { 18 TEST_F(BluetoothTest, GetUUIDAndGetIdentifier) {
19 InitWithFakeAdapter(); 19 InitWithFakeAdapter();
20 StartDiscoverySession(); 20 StartLowEnergyDiscoverySession();
21 BluetoothDevice* device = DiscoverLowEnergyDevice(3); 21 BluetoothDevice* device = DiscoverLowEnergyDevice(3);
22 device->CreateGattConnection(GetGattConnectionCallback(), 22 device->CreateGattConnection(GetGattConnectionCallback(),
23 GetConnectErrorCallback()); 23 GetConnectErrorCallback());
24 ResetEventCounts(); 24 ResetEventCounts();
25 SimulateGattConnection(device); 25 SimulateGattConnection(device);
26 EXPECT_EQ(1, gatt_discovery_attempts_); 26 EXPECT_EQ(1, gatt_discovery_attempts_);
27 27
28 // Create multiple instances with the same UUID. 28 // Create multiple instances with the same UUID.
29 BluetoothUUID uuid("00000000-0000-1000-8000-00805f9b34fb"); 29 BluetoothUUID uuid("00000000-0000-1000-8000-00805f9b34fb");
30 std::vector<std::string> services; 30 std::vector<std::string> services;
31 services.push_back(uuid.canonical_value()); 31 services.push_back(uuid.canonical_value());
32 services.push_back(uuid.canonical_value()); 32 services.push_back(uuid.canonical_value());
33 SimulateGattServicesDiscovered(device, services); 33 SimulateGattServicesDiscovered(device, services);
34 34
35 // Each has the same UUID. 35 // Each has the same UUID.
36 EXPECT_EQ(uuid, device->GetGattServices()[0]->GetUUID()); 36 EXPECT_EQ(uuid, device->GetGattServices()[0]->GetUUID());
37 EXPECT_EQ(uuid, device->GetGattServices()[1]->GetUUID()); 37 EXPECT_EQ(uuid, device->GetGattServices()[1]->GetUUID());
38 38
39 // Instance IDs are unique. 39 // Instance IDs are unique.
40 EXPECT_NE(device->GetGattServices()[0]->GetIdentifier(), 40 EXPECT_NE(device->GetGattServices()[0]->GetIdentifier(),
41 device->GetGattServices()[1]->GetIdentifier()); 41 device->GetGattServices()[1]->GetIdentifier());
42 } 42 }
43 #endif // defined(OS_ANDROID) 43 #endif // defined(OS_ANDROID)
44 44
45 } // namespace device 45 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698