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

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 a silly mistake in commit e4725886 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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 GetBaseGATTCharacteristic( 1016 GetBaseGATTCharacteristic(
1017 "Heart Rate Measurement", heart_rate.get(), kHeartRateMeasurementUUID, 1017 "Heart Rate Measurement", heart_rate.get(), kHeartRateMeasurementUUID,
1018 BluetoothRemoteGattCharacteristic::PROPERTY_NOTIFY)); 1018 BluetoothRemoteGattCharacteristic::PROPERTY_NOTIFY));
1019 NiceMockBluetoothGattCharacteristic* measurement_ptr = 1019 NiceMockBluetoothGattCharacteristic* measurement_ptr =
1020 heart_rate_measurement.get(); 1020 heart_rate_measurement.get();
1021 1021
1022 ON_CALL(*heart_rate_measurement, StartNotifySession(_, _)) 1022 ON_CALL(*heart_rate_measurement, StartNotifySession(_, _))
1023 .WillByDefault(RunCallbackWithResult<0 /* success_callback */>( 1023 .WillByDefault(RunCallbackWithResult<0 /* success_callback */>(
1024 [adapter, measurement_ptr]() { 1024 [adapter, measurement_ptr]() {
1025 std::unique_ptr<NiceMockBluetoothGattNotifySession> notify_session( 1025 std::unique_ptr<NiceMockBluetoothGattNotifySession> notify_session(
1026 GetBaseGATTNotifySession(measurement_ptr->GetIdentifier())); 1026 GetBaseGATTNotifySession(measurement_ptr->GetWeakPtr()));
1027 1027
1028 std::vector<uint8_t> rate(1 /* size */); 1028 std::vector<uint8_t> rate(1 /* size */);
1029 rate[0] = 60; 1029 rate[0] = 60;
1030 1030
1031 notify_session->StartTestNotifications(adapter, measurement_ptr, 1031 notify_session->StartTestNotifications(adapter, measurement_ptr,
1032 rate); 1032 rate);
1033 1033
1034 return notify_session; 1034 return notify_session;
1035 })); 1035 }));
1036 1036
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 .WillByDefault(RunCallback<1 /* error_callback */>(error_code)); 1145 .WillByDefault(RunCallback<1 /* error_callback */>(error_code));
1146 1146
1147 return characteristic; 1147 return characteristic;
1148 } 1148 }
1149 1149
1150 // Notify sessions 1150 // Notify sessions
1151 1151
1152 // static 1152 // static
1153 std::unique_ptr<NiceMockBluetoothGattNotifySession> 1153 std::unique_ptr<NiceMockBluetoothGattNotifySession>
1154 LayoutTestBluetoothAdapterProvider::GetBaseGATTNotifySession( 1154 LayoutTestBluetoothAdapterProvider::GetBaseGATTNotifySession(
1155 const std::string& characteristic_identifier) { 1155 base::WeakPtr<device::BluetoothRemoteGattCharacteristic> characteristic) {
1156 std::unique_ptr<NiceMockBluetoothGattNotifySession> session( 1156 std::unique_ptr<NiceMockBluetoothGattNotifySession> session(
1157 new NiceMockBluetoothGattNotifySession(characteristic_identifier)); 1157 new NiceMockBluetoothGattNotifySession(characteristic));
1158 1158
1159 ON_CALL(*session, Stop(_)) 1159 ON_CALL(*session, Stop(_))
1160 .WillByDefault(testing::DoAll( 1160 .WillByDefault(testing::DoAll(
1161 InvokeWithoutArgs( 1161 InvokeWithoutArgs(
1162 session.get(), 1162 session.get(),
1163 &MockBluetoothGattNotifySession::StopTestNotifications), 1163 &MockBluetoothGattNotifySession::StopTestNotifications),
1164 RunCallback<0>())); 1164 RunCallback<0>()));
1165 1165
1166 return session; 1166 return session;
1167 } 1167 }
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 return BluetoothUUID(); 1218 return BluetoothUUID();
1219 } 1219 }
1220 1220
1221 // static 1221 // static
1222 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) { 1222 std::string LayoutTestBluetoothAdapterProvider::makeMACAddress(uint64_t addr) {
1223 return BluetoothDevice::CanonicalizeAddress( 1223 return BluetoothDevice::CanonicalizeAddress(
1224 base::StringPrintf("%012" PRIx64, addr)); 1224 base::StringPrintf("%012" PRIx64, addr));
1225 } 1225 }
1226 1226
1227 } // namespace content 1227 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698