| OLD | NEW |
| 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_device.h" | 5 #include "device/bluetooth/bluetooth_device.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
| 14 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 14 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| 15 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h" | 15 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 #if defined(OS_ANDROID) | 18 #if defined(OS_ANDROID) |
| 19 #include "device/bluetooth/test/bluetooth_test_android.h" | 19 #include "device/bluetooth/test/bluetooth_test_android.h" |
| 20 #elif defined(OS_MACOSX) | 20 #elif defined(OS_MACOSX) |
| 21 #include "device/bluetooth/test/bluetooth_test_mac.h" | 21 #include "device/bluetooth/test/bluetooth_test_mac.h" |
| 22 #elif defined(OS_WIN) | 22 #elif defined(OS_WIN) |
| 23 #include "device/bluetooth/test/bluetooth_test_win.h" | 23 #include "device/bluetooth/test/bluetooth_test_win.h" |
| 24 #elif defined(OS_CHROMEOS) || defined(OS_LINUX) | 24 #elif defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 25 #include "device/bluetooth/test/bluetooth_test_bluez.h" | 25 #include "device/bluetooth/test/bluetooth_test_bluez.h" |
| 26 #endif | 26 #endif |
| 27 | 27 |
| 28 namespace device { | 28 namespace device { |
| 29 | 29 |
| 30 #if defined(OS_ANDROID) || defined(OS_MACOSX) |
| 31 |
| 30 namespace { | 32 namespace { |
| 31 | 33 |
| 32 int8_t ToInt8(BluetoothTest::TestRSSI rssi) { | 34 int8_t ToInt8(BluetoothTest::TestRSSI rssi) { |
| 33 return static_cast<int8_t>(rssi); | 35 return static_cast<int8_t>(rssi); |
| 34 } | 36 } |
| 35 | 37 |
| 36 int8_t ToInt8(BluetoothTest::TestTxPower tx_power) { | 38 int8_t ToInt8(BluetoothTest::TestTxPower tx_power) { |
| 37 return static_cast<int8_t>(tx_power); | 39 return static_cast<int8_t>(tx_power); |
| 38 } | 40 } |
| 39 | 41 |
| 40 } // namespace | 42 } // namespace |
| 41 | 43 |
| 44 #endif |
| 45 |
| 42 using UUIDSet = BluetoothDevice::UUIDSet; | 46 using UUIDSet = BluetoothDevice::UUIDSet; |
| 43 using ServiceDataMap = BluetoothDevice::ServiceDataMap; | 47 using ServiceDataMap = BluetoothDevice::ServiceDataMap; |
| 44 | 48 |
| 45 TEST(BluetoothDeviceTest, CanonicalizeAddressFormat_AcceptsAllValidFormats) { | 49 TEST(BluetoothDeviceTest, CanonicalizeAddressFormat_AcceptsAllValidFormats) { |
| 46 // There are three valid separators (':', '-', and none). | 50 // There are three valid separators (':', '-', and none). |
| 47 // Case shouldn't matter. | 51 // Case shouldn't matter. |
| 48 const char* const kValidFormats[] = { | 52 const char* const kValidFormats[] = { |
| 49 "1A:2B:3C:4D:5E:6F", | 53 "1A:2B:3C:4D:5E:6F", |
| 50 "1a:2B:3c:4D:5e:6F", | 54 "1a:2B:3c:4D:5e:6F", |
| 51 "1a:2b:3c:4d:5e:6f", | 55 "1a:2b:3c:4d:5e:6f", |
| (...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 | 1334 |
| 1331 BluetoothDevice* device2 = SimulateLowEnergyDevice(6); | 1335 BluetoothDevice* device2 = SimulateLowEnergyDevice(6); |
| 1332 EXPECT_EQ(BLUETOOTH_TRANSPORT_DUAL, device2->GetType()); | 1336 EXPECT_EQ(BLUETOOTH_TRANSPORT_DUAL, device2->GetType()); |
| 1333 | 1337 |
| 1334 BluetoothDevice* device3 = SimulateClassicDevice(); | 1338 BluetoothDevice* device3 = SimulateClassicDevice(); |
| 1335 EXPECT_EQ(BLUETOOTH_TRANSPORT_CLASSIC, device3->GetType()); | 1339 EXPECT_EQ(BLUETOOTH_TRANSPORT_CLASSIC, device3->GetType()); |
| 1336 } | 1340 } |
| 1337 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX) | 1341 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX) |
| 1338 | 1342 |
| 1339 } // namespace device | 1343 } // namespace device |
| OLD | NEW |