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

Side by Side Diff: content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc

Issue 2051333004: Implement BluetoothGattNotifySession::Stop on Android, 2nd attempt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error on windows Created 4 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid er.h" 5 #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provid er.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 GetBaseGATTCharacteristic( 1117 GetBaseGATTCharacteristic(
1118 "Heart Rate Measurement", heart_rate.get(), kHeartRateMeasurementUUID, 1118 "Heart Rate Measurement", heart_rate.get(), kHeartRateMeasurementUUID,
1119 BluetoothRemoteGattCharacteristic::PROPERTY_NOTIFY)); 1119 BluetoothRemoteGattCharacteristic::PROPERTY_NOTIFY));
1120 NiceMockBluetoothGattCharacteristic* measurement_ptr = 1120 NiceMockBluetoothGattCharacteristic* measurement_ptr =
1121 heart_rate_measurement.get(); 1121 heart_rate_measurement.get();
1122 1122
1123 ON_CALL(*heart_rate_measurement, StartNotifySession(_, _)) 1123 ON_CALL(*heart_rate_measurement, StartNotifySession(_, _))
1124 .WillByDefault(RunCallbackWithResult<0 /* success_callback */>( 1124 .WillByDefault(RunCallbackWithResult<0 /* success_callback */>(
1125 [adapter, measurement_ptr]() { 1125 [adapter, measurement_ptr]() {
1126 std::unique_ptr<NiceMockBluetoothGattNotifySession> notify_session( 1126 std::unique_ptr<NiceMockBluetoothGattNotifySession> notify_session(
1127 GetBaseGATTNotifySession(measurement_ptr->GetIdentifier())); 1127 GetBaseGATTNotifySession(measurement_ptr->GetWeakPtr()));
1128 1128
1129 std::vector<uint8_t> rate(1 /* size */); 1129 std::vector<uint8_t> rate(1 /* size */);
1130 rate[0] = 60; 1130 rate[0] = 60;
1131 1131
1132 notify_session->StartTestNotifications(adapter, measurement_ptr, 1132 notify_session->StartTestNotifications(adapter, measurement_ptr,
1133 rate); 1133 rate);
1134 1134
1135 return notify_session; 1135 return notify_session;
1136 })); 1136 }));
1137 1137
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 .WillByDefault(RunCallback<1 /* error_callback */>(error_code)); 1246 .WillByDefault(RunCallback<1 /* error_callback */>(error_code));
1247 1247
1248 return characteristic; 1248 return characteristic;
1249 } 1249 }
1250 1250
1251 // Notify sessions 1251 // Notify sessions
1252 1252
1253 // static 1253 // static
1254 std::unique_ptr<NiceMockBluetoothGattNotifySession> 1254 std::unique_ptr<NiceMockBluetoothGattNotifySession>
1255 LayoutTestBluetoothAdapterProvider::GetBaseGATTNotifySession( 1255 LayoutTestBluetoothAdapterProvider::GetBaseGATTNotifySession(
1256 const std::string& characteristic_identifier) { 1256 base::WeakPtr<device::BluetoothRemoteGattCharacteristic> characteristic) {
1257 std::unique_ptr<NiceMockBluetoothGattNotifySession> session( 1257 std::unique_ptr<NiceMockBluetoothGattNotifySession> session(
1258 new NiceMockBluetoothGattNotifySession(characteristic_identifier)); 1258 new NiceMockBluetoothGattNotifySession(characteristic));
1259 1259
1260 ON_CALL(*session, Stop(_)) 1260 ON_CALL(*session, Stop(_))
1261 .WillByDefault(testing::DoAll( 1261 .WillByDefault(testing::DoAll(
1262 InvokeWithoutArgs( 1262 InvokeWithoutArgs(
1263 session.get(), 1263 session.get(),
1264 &MockBluetoothGattNotifySession::StopTestNotifications), 1264 &MockBluetoothGattNotifySession::StopTestNotifications),
1265 RunCallback<0>())); 1265 RunCallback<0>()));
1266 1266
1267 return session; 1267 return session;
1268 } 1268 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1319 return BluetoothUUID(); 1319 return BluetoothUUID();
1320 } 1320 }
1321 1321
1322 // static 1322 // static
1323 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { 1323 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) {
1324 return BluetoothDevice::CanonicalizeAddress( 1324 return BluetoothDevice::CanonicalizeAddress(
1325 base::StringPrintf("%012" PRIx64, addr)); 1325 base::StringPrintf("%012" PRIx64, addr));
1326 } 1326 }
1327 1327
1328 } // namespace content 1328 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698