Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Side by Side Diff: device/bluetooth/bluetooth_adapter_unittest.cc

Issue 2339253002: bluetooth: mac: add connected LE devices to chooser (Closed)
Patch Set: Adding BluetoothAdapter::RetrievedConnectedPeripherals() and the implementation in BluetoothAdapter… Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_adapter.h" 5 #include "device/bluetooth/bluetooth_adapter.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 852 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED), 863 device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED),
864 GetConnectErrorCallback(Call::NOT_EXPECTED)); 864 GetConnectErrorCallback(Call::NOT_EXPECTED));
865 SimulateGattConnection(device); 865 SimulateGattConnection(device);
866 EXPECT_EQ(1u, adapter_->GetDevices().size()); 866 EXPECT_EQ(1u, adapter_->GetDevices().size());
867 RemoveTimedOutDevices(); 867 RemoveTimedOutDevices();
868 EXPECT_EQ(0, observer.device_removed_count()); 868 EXPECT_EQ(0, observer.device_removed_count());
869 EXPECT_EQ(1u, adapter_->GetDevices().size()); 869 EXPECT_EQ(1u, adapter_->GetDevices().size());
870 } 870 }
871 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) 871 #endif // defined(OS_ANDROID) || defined(OS_MACOSX)
872 872
873 #if defined(OS_MACOSX)
874 // Simulate a device being connected before starting discovery session.
875 TEST_F(BluetoothTest, DiscoverConnectedLowEnergyDevice) {
876 if (!PlatformSupportsLowEnergy()) {
877 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
878 return;
879 }
880 InitWithFakeAdapter();
881 TestBluetoothAdapterObserver observer(adapter_);
882
883 SimulateConnectedLowEnergyDevice();
884 // Start discovery and find a device.
885 StartLowEnergyDiscoverySession();
886 SimulateLowEnergyDevice(4);
887 EXPECT_EQ(2, observer.device_added_count());
888 EXPECT_EQ(2u, adapter_->GetDevices().size());
889 }
890 #endif // defined(OS_MACOSX)
891
873 } // namespace device 892 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698