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, GetIdentifier()) | 27 ON_CALL(*this, GetIdentifier()) |
27 .WillByDefault(testing::Return(address_ + "-Identifier")); | 28 .WillByDefault(testing::Return(address_ + "-Identifier")); |
28 ON_CALL(*this, GetAddress()) | 29 ON_CALL(*this, GetAddress()) |
29 .WillByDefault(testing::Return(address_)); | 30 .WillByDefault(testing::Return(address_)); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 BluetoothGattService* MockBluetoothDevice::GetMockService( | 77 BluetoothGattService* MockBluetoothDevice::GetMockService( |
77 const std::string& identifier) const { | 78 const std::string& identifier) const { |
78 for (BluetoothGattService* service : mock_services_) { | 79 for (BluetoothGattService* service : mock_services_) { |
79 if (service->GetIdentifier() == identifier) | 80 if (service->GetIdentifier() == identifier) |
80 return service; | 81 return service; |
81 } | 82 } |
82 return nullptr; | 83 return nullptr; |
83 } | 84 } |
84 | 85 |
85 } // namespace device | 86 } // namespace device |
OLD | NEW |