| 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 <stddef.h> |
| 6 #include <stdint.h> |
| 7 |
| 5 #include "base/bind.h" | 8 #include "base/bind.h" |
| 6 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 7 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "build/build_config.h" |
| 8 #include "device/bluetooth/bluetooth_adapter.h" | 12 #include "device/bluetooth/bluetooth_adapter.h" |
| 9 #include "device/bluetooth/bluetooth_device.h" | 13 #include "device/bluetooth/bluetooth_device.h" |
| 10 #include "device/bluetooth/bluetooth_discovery_session.h" | 14 #include "device/bluetooth/bluetooth_discovery_session.h" |
| 11 #include "device/bluetooth/test/bluetooth_test.h" | 15 #include "device/bluetooth/test/bluetooth_test.h" |
| 12 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h" | 16 #include "device/bluetooth/test/test_bluetooth_adapter_observer.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 18 |
| 15 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
| 16 #include "device/bluetooth/test/bluetooth_test_android.h" | 20 #include "device/bluetooth/test/bluetooth_test_android.h" |
| 17 #elif defined(OS_MACOSX) | 21 #elif defined(OS_MACOSX) |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 void RemovePairingDelegateInternal( | 130 void RemovePairingDelegateInternal( |
| 127 BluetoothDevice::PairingDelegate* pairing_delegate) override {} | 131 BluetoothDevice::PairingDelegate* pairing_delegate) override {} |
| 128 }; | 132 }; |
| 129 | 133 |
| 130 class TestPairingDelegate : public BluetoothDevice::PairingDelegate { | 134 class TestPairingDelegate : public BluetoothDevice::PairingDelegate { |
| 131 public: | 135 public: |
| 132 void RequestPinCode(BluetoothDevice* device) override {} | 136 void RequestPinCode(BluetoothDevice* device) override {} |
| 133 void RequestPasskey(BluetoothDevice* device) override {} | 137 void RequestPasskey(BluetoothDevice* device) override {} |
| 134 void DisplayPinCode(BluetoothDevice* device, | 138 void DisplayPinCode(BluetoothDevice* device, |
| 135 const std::string& pincode) override {} | 139 const std::string& pincode) override {} |
| 136 void DisplayPasskey(BluetoothDevice* device, uint32 passkey) override {} | 140 void DisplayPasskey(BluetoothDevice* device, uint32_t passkey) override {} |
| 137 void KeysEntered(BluetoothDevice* device, uint32 entered) override {} | 141 void KeysEntered(BluetoothDevice* device, uint32_t entered) override {} |
| 138 void ConfirmPasskey(BluetoothDevice* device, uint32 passkey) override {} | 142 void ConfirmPasskey(BluetoothDevice* device, uint32_t passkey) override {} |
| 139 void AuthorizePairing(BluetoothDevice* device) override {} | 143 void AuthorizePairing(BluetoothDevice* device) override {} |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 TEST(BluetoothAdapterTest, NoDefaultPairingDelegate) { | 146 TEST(BluetoothAdapterTest, NoDefaultPairingDelegate) { |
| 143 scoped_refptr<BluetoothAdapter> adapter = new TestBluetoothAdapter(); | 147 scoped_refptr<BluetoothAdapter> adapter = new TestBluetoothAdapter(); |
| 144 | 148 |
| 145 // Verify that when there is no registered pairing delegate, NULL is returned. | 149 // Verify that when there is no registered pairing delegate, NULL is returned. |
| 146 EXPECT_TRUE(adapter->DefaultPairingDelegate() == NULL); | 150 EXPECT_TRUE(adapter->DefaultPairingDelegate() == NULL); |
| 147 } | 151 } |
| 148 | 152 |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 // Start discovery and find a device. | 606 // Start discovery and find a device. |
| 603 StartLowEnergyDiscoverySession(); | 607 StartLowEnergyDiscoverySession(); |
| 604 DiscoverLowEnergyDevice(1); | 608 DiscoverLowEnergyDevice(1); |
| 605 DiscoverLowEnergyDevice(4); | 609 DiscoverLowEnergyDevice(4); |
| 606 EXPECT_EQ(2, observer.device_added_count()); | 610 EXPECT_EQ(2, observer.device_added_count()); |
| 607 EXPECT_EQ(2u, adapter_->GetDevices().size()); | 611 EXPECT_EQ(2u, adapter_->GetDevices().size()); |
| 608 } | 612 } |
| 609 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) | 613 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) |
| 610 | 614 |
| 611 } // namespace device | 615 } // namespace device |
| OLD | NEW |