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" |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 EXPECT_TRUE(device->GetUUIDs().empty()); | 666 EXPECT_TRUE(device->GetUUIDs().empty()); |
667 #if defined(OS_MACOSX) | 667 #if defined(OS_MACOSX) |
668 // TODO(ortuno): Enable on Android once it supports Service Data. | 668 // TODO(ortuno): Enable on Android once it supports Service Data. |
669 // http://crbug.com/639408 | 669 // http://crbug.com/639408 |
670 EXPECT_TRUE(device->GetServiceData().empty()); | 670 EXPECT_TRUE(device->GetServiceData().empty()); |
671 #endif // defined(OS_MACOSX) | 671 #endif // defined(OS_MACOSX) |
672 EXPECT_FALSE(device->GetInquiryTxPower()); | 672 EXPECT_FALSE(device->GetInquiryTxPower()); |
673 } | 673 } |
674 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) | 674 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) |
675 | 675 |
676 #if defined(OS_ANDROID) || defined(OS_MACOSX) | 676 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_MACOSX) |
677 // GetName for Device with no name. | 677 // GetName for Device with no name. |
678 TEST_F(BluetoothTest, GetName_NullName) { | 678 TEST_F(BluetoothTest, GetName_NullName) { |
679 if (!PlatformSupportsLowEnergy()) { | 679 if (!PlatformSupportsLowEnergy()) { |
680 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; | 680 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; |
681 return; | 681 return; |
682 } | 682 } |
683 InitWithFakeAdapter(); | 683 InitWithFakeAdapter(); |
| 684 |
| 685 // StartLowEnergyDiscoverySession is not yet implemented on ChromeOS|bluez, |
| 686 // and is non trivial to implement. On ChromeOS, it is not essential for |
| 687 // this test to operate, and so it is simply skipped. Android at least |
| 688 // does require this step. |
| 689 #if !defined(OS_CHROMEOS) |
684 StartLowEnergyDiscoverySession(); | 690 StartLowEnergyDiscoverySession(); |
| 691 #endif |
| 692 |
685 BluetoothDevice* device = SimulateLowEnergyDevice(5); | 693 BluetoothDevice* device = SimulateLowEnergyDevice(5); |
686 EXPECT_FALSE(device->GetName()); | 694 EXPECT_FALSE(device->GetName()); |
687 } | 695 } |
688 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) | 696 #endif // defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_MACOSX) |
689 | 697 |
690 // TODO(506415): Test GetNameForDisplay with a device with no name. | 698 // TODO(506415): Test GetNameForDisplay with a device with no name. |
691 // BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() will run, which | 699 // BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() will run, which |
692 // requires string resources to be loaded. For that, something like | 700 // requires string resources to be loaded. For that, something like |
693 // InitSharedInstance must be run. See unittest files that call that. It will | 701 // InitSharedInstance must be run. See unittest files that call that. It will |
694 // also require build configuration to generate string resources into a .pak | 702 // also require build configuration to generate string resources into a .pak |
695 // file. | 703 // file. |
696 | 704 |
697 #if defined(OS_ANDROID) || defined(OS_MACOSX) | 705 #if defined(OS_ANDROID) || defined(OS_MACOSX) |
698 // Basic CreateGattConnection test. | 706 // Basic CreateGattConnection test. |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 | 1330 |
1323 BluetoothDevice* device2 = SimulateLowEnergyDevice(6); | 1331 BluetoothDevice* device2 = SimulateLowEnergyDevice(6); |
1324 EXPECT_EQ(BLUETOOTH_TRANSPORT_DUAL, device2->GetType()); | 1332 EXPECT_EQ(BLUETOOTH_TRANSPORT_DUAL, device2->GetType()); |
1325 | 1333 |
1326 BluetoothDevice* device3 = SimulateClassicDevice(); | 1334 BluetoothDevice* device3 = SimulateClassicDevice(); |
1327 EXPECT_EQ(BLUETOOTH_TRANSPORT_CLASSIC, device3->GetType()); | 1335 EXPECT_EQ(BLUETOOTH_TRANSPORT_CLASSIC, device3->GetType()); |
1328 } | 1336 } |
1329 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX) | 1337 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX) |
1330 | 1338 |
1331 } // namespace device | 1339 } // namespace device |
OLD | NEW |