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

Side by Side Diff: device/bluetooth/bluetooth_adapter_mac_unittest.mm

Issue 2906923002: bluetooth: macOS: Remove c-style casting (Closed)
Patch Set: Merge from top of tree Created 3 years, 7 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
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_mac.h" 5 #include "device/bluetooth/bluetooth_adapter_mac.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 } 93 }
94 94
95 bool SetMockCentralManager(CBCentralManagerState desired_state) { 95 bool SetMockCentralManager(CBCentralManagerState desired_state) {
96 if (!BluetoothAdapterMac::IsLowEnergyAvailable()) { 96 if (!BluetoothAdapterMac::IsLowEnergyAvailable()) {
97 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test."; 97 LOG(WARNING) << "Low Energy Bluetooth unavailable, skipping unit test.";
98 return false; 98 return false;
99 } 99 }
100 mock_central_manager_.reset([[MockCentralManager alloc] init]); 100 mock_central_manager_.reset([[MockCentralManager alloc] init]);
101 [mock_central_manager_ setState:desired_state]; 101 [mock_central_manager_ setState:desired_state];
102 CBCentralManager* centralManager = 102 CBCentralManager* centralManager =
103 (CBCentralManager*)mock_central_manager_.get(); 103 static_cast<CBCentralManager*>(mock_central_manager_.get());
104 adapter_mac_->SetCentralManagerForTesting(centralManager); 104 adapter_mac_->SetCentralManagerForTesting(centralManager);
105 return true; 105 return true;
106 } 106 }
107 107
108 void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter) { 108 void AddDiscoverySession(BluetoothDiscoveryFilter* discovery_filter) {
109 adapter_mac_->AddDiscoverySession( 109 adapter_mac_->AddDiscoverySession(
110 discovery_filter, 110 discovery_filter,
111 base::Bind(&BluetoothAdapterMacTest::Callback, base::Unretained(this)), 111 base::Bind(&BluetoothAdapterMacTest::Callback, base::Unretained(this)),
112 base::Bind(&BluetoothAdapterMacTest::DiscoveryErrorCallback, 112 base::Bind(&BluetoothAdapterMacTest::DiscoveryErrorCallback,
113 base::Unretained(this))); 113 base::Unretained(this)));
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 base::scoped_nsobject<NSDictionary> advertisement_data(AdvertisementData()); 249 base::scoped_nsobject<NSDictionary> advertisement_data(AdvertisementData());
250 250
251 EXPECT_EQ(0, NumDevices()); 251 EXPECT_EQ(0, NumDevices());
252 EXPECT_FALSE(DevicePresent(mock_peripheral)); 252 EXPECT_FALSE(DevicePresent(mock_peripheral));
253 LowEnergyDeviceUpdated(mock_peripheral, advertisement_data, kTestRssi); 253 LowEnergyDeviceUpdated(mock_peripheral, advertisement_data, kTestRssi);
254 EXPECT_EQ(1, NumDevices()); 254 EXPECT_EQ(1, NumDevices());
255 EXPECT_TRUE(DevicePresent(mock_peripheral)); 255 EXPECT_TRUE(DevicePresent(mock_peripheral));
256 } 256 }
257 257
258 } // namespace device 258 } // namespace device
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698