Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "device/bluetooth/bluetooth_gatt_service.h" | |
| 6 | |
| 7 #include "testing/gtest/include/gtest/gtest.h" | |
| 8 | |
| 9 #if defined(OS_ANDROID) | |
| 10 #include "device/bluetooth/test/bluetooth_test_android.h" | |
| 11 #elif defined(OS_MACOSX) | |
| 12 #include "device/bluetooth/test/bluetooth_test_mac.h" | |
| 13 #endif | |
| 14 | |
| 15 namespace device { | |
| 16 | |
| 17 #if defined(OS_ANDROID) | |
| 18 TEST_F(BluetoothTest, GetUUID) { | |
| 19 InitWithFakeAdapter(); | |
| 20 StartDiscoverySession(); | |
| 21 BluetoothDevice* device = DiscoverLowEnergyDevice(3); | |
| 22 device->CreateGattConnection(GetGattConnectionCallback(), | |
| 23 GetConnectErrorCallback()); | |
| 24 ResetEventCounts(); | |
| 25 SimulateGattConnection(device); | |
| 26 EXPECT_EQ(1, gatt_discovery_attempts_); | |
| 27 | |
| 28 // Create multiple instances, verifying each can have the same UUID. | |
| 29 BluetoothUUID uuid("00000000-0000-1000-8000-00805f9b34fb"); | |
| 30 std::vector<std::string> services; | |
| 31 services.push_back(uuid.canonical_value()); | |
| 32 services.push_back(uuid.canonical_value()); | |
| 33 SimulateGattServicesDiscovered(device, services); | |
| 34 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.
| |
| 35 EXPECT_EQ(uuid, device->GetGattServices()[1]->GetUUID()); | |
| 36 } | |
| 37 #endif // defined(OS_ANDROID) | |
| 38 | |
| 39 } // namespace device | |
| OLD | NEW |