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

Unified Diff: device/bluetooth/test/bluetooth_test_mac.mm

Issue 2071853002: Revert of bluetooth: mac: Initial BluetoothRemoteGattCharacteristicMac implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@servicescan_cleanup
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: device/bluetooth/test/bluetooth_test_mac.mm
diff --git a/device/bluetooth/test/bluetooth_test_mac.mm b/device/bluetooth/test/bluetooth_test_mac.mm
index 41ca2742d935fd866294e3fd58225a1871437bdc..cc4b8d85f108e4324b61616c904472b36a309f8d 100644
--- a/device/bluetooth/test/bluetooth_test_mac.mm
+++ b/device/bluetooth/test/bluetooth_test_mac.mm
@@ -10,11 +10,8 @@
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "device/bluetooth/bluetooth_adapter_mac.h"
-#include "device/bluetooth/bluetooth_remote_gatt_characteristic_mac.h"
#include "device/bluetooth/bluetooth_remote_gatt_service_mac.h"
-#include "device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h"
#include "device/bluetooth/test/mock_bluetooth_cbperipheral_mac.h"
-#include "device/bluetooth/test/mock_bluetooth_cbservice_mac.h"
#include "device/bluetooth/test/mock_bluetooth_central_manager_mac.h"
#include "device/bluetooth/test/test_bluetooth_adapter_observer.h"
#include "third_party/ocmock/OCMock/OCMock.h"
@@ -23,18 +20,6 @@
using base::mac::ObjCCast;
using base::scoped_nsobject;
-
-namespace {
-
-void DidDiscoverServices(MockCBPeripheral* peripheral_mock) {
- [peripheral_mock didDiscoverServicesWithError:nil];
- // BluetoothLowEnergyDeviceMac is expected to call
- // -[CBPeripheral discoverCharacteristics:forService:] for each services,
- // so -[<CBPeripheralDelegate peripheral:didDiscoverCharacteristicsForService:
- // error:] needs to be called
- [peripheral_mock didDiscoverCharactericsForAllServices];
-}
-} // namespace
namespace device {
@@ -252,7 +237,7 @@
[services addObject:cb_service_uuid];
}
[peripheral_mock addServices:services];
- DidDiscoverServices(peripheral_mock);
+ [peripheral_mock didDiscoverServicesWithError:nil];
}
void BluetoothTestMac::SimulateGattServiceRemoved(
@@ -267,44 +252,7 @@
CBPeripheral* peripheral = device_mac->GetPeripheral();
MockCBPeripheral* peripheral_mock = ObjCCast<MockCBPeripheral>(peripheral);
[peripheral_mock removeService:mac_gatt_service->GetService()];
- // After -[MockCBPeripheral removeService:], BluetoothLowEnergyDeviceMac is
- // expected to call -[CBPeripheral discoverServices:]
- DidDiscoverServices(peripheral_mock);
-}
-
-void BluetoothTestMac::SimulateGattCharacteristic(
- BluetoothRemoteGattService* service,
- const std::string& uuid,
- int properties) {
- BluetoothRemoteGattServiceMac* mac_gatt_service =
- static_cast<BluetoothRemoteGattServiceMac*>(service);
- CBService* cb_service = mac_gatt_service->GetService();
- MockCBService* service_mock = ObjCCast<MockCBService>(cb_service);
- CBUUID* cb_uuid = [CBUUID UUIDWithString:@(uuid.c_str())];
- [service_mock addCharacteristicWithUUID:cb_uuid properties:properties];
- MockCBPeripheral* peripheral_mock = GetMockCBPeripheral(service);
- [peripheral_mock didModifyServices:@[]];
- // After -[MockCBPeripheral didModifyServices:], BluetoothLowEnergyDeviceMac
- // is expected to call -[CBPeripheral discoverServices:]
- DidDiscoverServices(peripheral_mock);
-}
-
-void BluetoothTestMac::SimulateGattCharacteristicRemoved(
- BluetoothRemoteGattService* service,
- BluetoothRemoteGattCharacteristic* characteristic) {
- MockCBPeripheral* peripheral_mock = GetMockCBPeripheral(service);
- BluetoothRemoteGattServiceMac* mac_gatt_service =
- static_cast<BluetoothRemoteGattServiceMac*>(service);
- CBService* cb_service = mac_gatt_service->GetService();
- MockCBService* service_mock = ObjCCast<MockCBService>(cb_service);
- BluetoothRemoteGattCharacteristicMac* characteristic_mac =
- static_cast<BluetoothRemoteGattCharacteristicMac*>(characteristic);
- CBCharacteristic* cb_characteristic =
- characteristic_mac->GetCBCharacteristic();
- MockCBCharacteristic* characteristic_mock =
- ObjCCast<MockCBCharacteristic>(cb_characteristic);
- [service_mock removeCharacteristicMock:characteristic_mock];
- DidDiscoverServices(peripheral_mock);
+ [peripheral_mock didDiscoverServicesWithError:nil];
}
void BluetoothTestMac::OnFakeBluetoothDeviceConnectGattCalled() {
@@ -317,15 +265,6 @@
void BluetoothTestMac::OnFakeBluetoothServiceDiscovery() {
gatt_discovery_attempts_++;
-}
-
-MockCBPeripheral* BluetoothTestMac::GetMockCBPeripheral(
- BluetoothRemoteGattService* service) const {
- BluetoothDevice* device = service->GetDevice();
- BluetoothLowEnergyDeviceMac* device_mac =
- static_cast<BluetoothLowEnergyDeviceMac*>(device);
- CBPeripheral* cb_peripheral = device_mac->GetPeripheral();
- return ObjCCast<MockCBPeripheral>(cb_peripheral);
}
// Utility function for generating new (CBUUID, address) pairs where CBUUID
« no previous file with comments | « device/bluetooth/test/bluetooth_test_mac.h ('k') | device/bluetooth/test/mock_bluetooth_cbcharacteristic_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698