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

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

Issue 2339253002: bluetooth: mac: add connected LE devices to chooser (Closed)
Patch Set: Better implementation 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 847 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED), 858 device->CreateGattConnection(GetGattConnectionCallback(Call::EXPECTED),
859 GetConnectErrorCallback(Call::NOT_EXPECTED)); 859 GetConnectErrorCallback(Call::NOT_EXPECTED));
860 SimulateGattConnection(device); 860 SimulateGattConnection(device);
861 EXPECT_EQ(1u, adapter_->GetDevices().size()); 861 EXPECT_EQ(1u, adapter_->GetDevices().size());
862 RemoveTimedOutDevices(); 862 RemoveTimedOutDevices();
863 EXPECT_EQ(0, observer.device_removed_count()); 863 EXPECT_EQ(0, observer.device_removed_count());
864 EXPECT_EQ(1u, adapter_->GetDevices().size()); 864 EXPECT_EQ(1u, adapter_->GetDevices().size());
865 } 865 }
866 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) 866 #endif // defined(OS_ANDROID) || defined(OS_MACOSX)
867 867
868 #if defined(OS_MACOSX)
869 // Simulate a device being connected before starting discovery session.
870 TEST_F(BluetoothTest, DiscoverConnectedLowEnergyDevice) {
871 if (!PlatformSupportsLowEnergy()) {
872 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
873 return;
874 }
875 InitWithFakeAdapter();
876 TestBluetoothAdapterObserver observer(adapter_);
877
878 SimulateConnectedLowEnergyDevice();
879 adapter_->RetrieveUnknownGattConnectedDevices();
880
881 EXPECT_EQ(1, observer.device_added_count());
882 EXPECT_EQ(1u, adapter_->GetDevices().size());
883 }
884 #endif // defined(OS_MACOSX)
885
868 } // namespace device 886 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698