OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/mock_bluetooth_device.h" | 5 #include "device/bluetooth/test/mock_bluetooth_device.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "device/bluetooth/bluetooth_gatt_service.h" | 8 #include "device/bluetooth/bluetooth_gatt_service.h" |
9 #include "device/bluetooth/test/mock_bluetooth_adapter.h" | 9 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
10 | 10 |
11 namespace device { | 11 namespace device { |
12 | 12 |
13 MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter, | 13 MockBluetoothDevice::MockBluetoothDevice(MockBluetoothAdapter* adapter, |
14 uint32 bluetooth_class, | 14 uint32 bluetooth_class, |
15 const std::string& name, | 15 const std::string& name, |
16 const std::string& address, | 16 const std::string& address, |
17 bool paired, | 17 bool paired, |
18 bool connected) | 18 bool connected) |
19 : bluetooth_class_(bluetooth_class), | 19 : BluetoothDevice(adapter), |
| 20 bluetooth_class_(bluetooth_class), |
20 name_(name), | 21 name_(name), |
21 address_(address) { | 22 address_(address) { |
22 ON_CALL(*this, GetBluetoothClass()) | 23 ON_CALL(*this, GetBluetoothClass()) |
23 .WillByDefault(testing::Return(bluetooth_class_)); | 24 .WillByDefault(testing::Return(bluetooth_class_)); |
24 ON_CALL(*this, GetDeviceName()) | 25 ON_CALL(*this, GetDeviceName()) |
25 .WillByDefault(testing::Return(name_)); | 26 .WillByDefault(testing::Return(name_)); |
26 ON_CALL(*this, GetAddress()) | 27 ON_CALL(*this, GetAddress()) |
27 .WillByDefault(testing::Return(address_)); | 28 .WillByDefault(testing::Return(address_)); |
28 ON_CALL(*this, GetDeviceType()) | 29 ON_CALL(*this, GetDeviceType()) |
29 .WillByDefault(testing::Return(DEVICE_UNKNOWN)); | 30 .WillByDefault(testing::Return(DEVICE_UNKNOWN)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 BluetoothGattService* MockBluetoothDevice::GetMockService( | 75 BluetoothGattService* MockBluetoothDevice::GetMockService( |
75 const std::string& identifier) const { | 76 const std::string& identifier) const { |
76 for (BluetoothGattService* service : mock_services_) { | 77 for (BluetoothGattService* service : mock_services_) { |
77 if (service->GetIdentifier() == identifier) | 78 if (service->GetIdentifier() == identifier) |
78 return service; | 79 return service; |
79 } | 80 } |
80 return nullptr; | 81 return nullptr; |
81 } | 82 } |
82 | 83 |
83 } // namespace device | 84 } // namespace device |
OLD | NEW |