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 StartLowEnergyDiscoverySession(); | |
scheib
2016/11/03 23:48:14
StartLowEnergyDiscoverySession() is not needed for
| |
685 BluetoothDevice* device = SimulateLowEnergyDevice(5); | 684 BluetoothDevice* device = SimulateLowEnergyDevice(5); |
686 EXPECT_FALSE(device->GetName()); | 685 EXPECT_FALSE(device->GetName()); |
687 } | 686 } |
688 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) | 687 #endif // defined(OS_ANDROID) || defined(OS_CHROMEOS) || defined(OS_MACOSX) |
689 | 688 |
690 // TODO(506415): Test GetNameForDisplay with a device with no name. | 689 // TODO(506415): Test GetNameForDisplay with a device with no name. |
691 // BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() will run, which | 690 // BluetoothDevice::GetAddressWithLocalizedDeviceTypeName() will run, which |
692 // requires string resources to be loaded. For that, something like | 691 // requires string resources to be loaded. For that, something like |
693 // InitSharedInstance must be run. See unittest files that call that. It will | 692 // InitSharedInstance must be run. See unittest files that call that. It will |
694 // also require build configuration to generate string resources into a .pak | 693 // also require build configuration to generate string resources into a .pak |
695 // file. | 694 // file. |
696 | 695 |
697 #if defined(OS_ANDROID) || defined(OS_MACOSX) | 696 #if defined(OS_ANDROID) || defined(OS_MACOSX) |
698 // Basic CreateGattConnection test. | 697 // Basic CreateGattConnection test. |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1322 | 1321 |
1323 BluetoothDevice* device2 = SimulateLowEnergyDevice(6); | 1322 BluetoothDevice* device2 = SimulateLowEnergyDevice(6); |
1324 EXPECT_EQ(BLUETOOTH_TRANSPORT_DUAL, device2->GetType()); | 1323 EXPECT_EQ(BLUETOOTH_TRANSPORT_DUAL, device2->GetType()); |
1325 | 1324 |
1326 BluetoothDevice* device3 = SimulateClassicDevice(); | 1325 BluetoothDevice* device3 = SimulateClassicDevice(); |
1327 EXPECT_EQ(BLUETOOTH_TRANSPORT_CLASSIC, device3->GetType()); | 1326 EXPECT_EQ(BLUETOOTH_TRANSPORT_CLASSIC, device3->GetType()); |
1328 } | 1327 } |
1329 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX) | 1328 #endif // defined(OS_CHROMEOS) || defined(OS_LINUX) |
1330 | 1329 |
1331 } // namespace device | 1330 } // namespace device |
OLD | NEW |