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

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

Issue 2242833002: Bluetooth: mac: add connected BLE devices at startup Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Device: bluetooth: use untyped containers Created 4 years, 3 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 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 InitWithFakeAdapter(); 472 InitWithFakeAdapter();
473 EXPECT_EQ(adapter_->GetAddress(), kTestAdapterAddress); 473 EXPECT_EQ(adapter_->GetAddress(), kTestAdapterAddress);
474 EXPECT_EQ(adapter_->GetName(), kTestAdapterName); 474 EXPECT_EQ(adapter_->GetName(), kTestAdapterName);
475 EXPECT_TRUE(adapter_->IsPresent()); 475 EXPECT_TRUE(adapter_->IsPresent());
476 EXPECT_TRUE(adapter_->IsPowered()); 476 EXPECT_TRUE(adapter_->IsPowered());
477 EXPECT_FALSE(adapter_->IsDiscoverable()); 477 EXPECT_FALSE(adapter_->IsDiscoverable());
478 EXPECT_FALSE(adapter_->IsDiscovering()); 478 EXPECT_FALSE(adapter_->IsDiscovering());
479 } 479 }
480 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN) 480 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) || defined(OS_WIN)
481 481
482 // TODO(jracle): Enable this test on other platforms.
483 #if defined(OS_MACOSX)
484 TEST_F(BluetoothTest, ConstructFakeAdapterWithConnectedLowEnergyDevice) {
485 if (!PlatformSupportsLowEnergy()) {
486 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
487 return;
488 }
489
490 InitWithFakeAdapterWithConnectedLowEnergyDevice();
491
492 EXPECT_EQ(1u, adapter_->GetDevices().size());
493 EXPECT_EQ(adapter_->GetDevices()[0]->GetName(), kTestDeviceName);
494 EXPECT_FALSE(adapter_->GetDevices()[0]->IsGattConnected());
495 }
496 #endif // defined(OS_MACOSX)
497
482 // TODO(scheib): Enable BluetoothTest fixture tests on all platforms. 498 // TODO(scheib): Enable BluetoothTest fixture tests on all platforms.
483 #if defined(OS_ANDROID) 499 #if defined(OS_ANDROID)
484 // Starts and Stops a discovery session. 500 // Starts and Stops a discovery session.
485 TEST_F(BluetoothTest, DiscoverySession) { 501 TEST_F(BluetoothTest, DiscoverySession) {
486 InitWithFakeAdapter(); 502 InitWithFakeAdapter();
487 EXPECT_FALSE(adapter_->IsDiscovering()); 503 EXPECT_FALSE(adapter_->IsDiscovering());
488 504
489 StartLowEnergyDiscoverySession(); 505 StartLowEnergyDiscoverySession();
490 EXPECT_EQ(1, callback_count_); 506 EXPECT_EQ(1, callback_count_);
491 EXPECT_EQ(0, error_callback_count_); 507 EXPECT_EQ(0, error_callback_count_);
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
856 GetConnectErrorCallback(Call::NOT_EXPECTED)); 872 GetConnectErrorCallback(Call::NOT_EXPECTED));
857 SimulateGattConnection(device); 873 SimulateGattConnection(device);
858 EXPECT_EQ(1u, adapter_->GetDevices().size()); 874 EXPECT_EQ(1u, adapter_->GetDevices().size());
859 RemoveTimedOutDevices(); 875 RemoveTimedOutDevices();
860 EXPECT_EQ(0, observer.device_removed_count()); 876 EXPECT_EQ(0, observer.device_removed_count());
861 EXPECT_EQ(1u, adapter_->GetDevices().size()); 877 EXPECT_EQ(1u, adapter_->GetDevices().size());
862 } 878 }
863 #endif // defined(OS_ANDROID) || defined(OS_MACOSX) 879 #endif // defined(OS_ANDROID) || defined(OS_MACOSX)
864 880
865 } // namespace device 881 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_adapter_mac.mm ('k') | device/bluetooth/bluetooth_low_energy_device_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698