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 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ON_CALL(*this, ExpectingPasskey()) | 53 ON_CALL(*this, ExpectingPasskey()) |
54 .WillByDefault(testing::Return(false)); | 54 .WillByDefault(testing::Return(false)); |
55 ON_CALL(*this, ExpectingConfirmation()) | 55 ON_CALL(*this, ExpectingConfirmation()) |
56 .WillByDefault(testing::Return(false)); | 56 .WillByDefault(testing::Return(false)); |
57 ON_CALL(*this, GetUUIDs()) | 57 ON_CALL(*this, GetUUIDs()) |
58 .WillByDefault(testing::Return(uuids_)); | 58 .WillByDefault(testing::Return(uuids_)); |
59 } | 59 } |
60 | 60 |
61 MockBluetoothDevice::~MockBluetoothDevice() {} | 61 MockBluetoothDevice::~MockBluetoothDevice() {} |
62 | 62 |
| 63 scoped_ptr<device::BluetoothGattConnection> |
| 64 MockBluetoothDevice::CreateGattConnection( |
| 65 const GattConnectionCallback& callback, |
| 66 const ConnectErrorCallback& error_callback) { |
| 67 return scoped_ptr<device::BluetoothGattConnection>( |
| 68 CreateGattConnectionRaw(callback, error_callback)) |
| 69 .Pass(); |
| 70 } |
| 71 |
| 72 scoped_ptr<device::BluetoothGattConnection> |
| 73 MockBluetoothDevice::CreateGattConnectionImpl() { |
| 74 return scoped_ptr<device::BluetoothGattConnection>( |
| 75 CreateGattConnectionImplRaw()) |
| 76 .Pass(); |
| 77 } |
| 78 |
63 void MockBluetoothDevice::AddMockService( | 79 void MockBluetoothDevice::AddMockService( |
64 scoped_ptr<MockBluetoothGattService> mock_service) { | 80 scoped_ptr<MockBluetoothGattService> mock_service) { |
65 mock_services_.push_back(mock_service.Pass()); | 81 mock_services_.push_back(mock_service.Pass()); |
66 } | 82 } |
67 | 83 |
68 std::vector<BluetoothGattService*> MockBluetoothDevice::GetMockServices() | 84 std::vector<BluetoothGattService*> MockBluetoothDevice::GetMockServices() |
69 const { | 85 const { |
70 std::vector<BluetoothGattService*> services; | 86 std::vector<BluetoothGattService*> services; |
71 for (BluetoothGattService* service : mock_services_) { | 87 for (BluetoothGattService* service : mock_services_) { |
72 services.push_back(service); | 88 services.push_back(service); |
73 } | 89 } |
74 return services; | 90 return services; |
75 } | 91 } |
76 | 92 |
77 BluetoothGattService* MockBluetoothDevice::GetMockService( | 93 BluetoothGattService* MockBluetoothDevice::GetMockService( |
78 const std::string& identifier) const { | 94 const std::string& identifier) const { |
79 for (BluetoothGattService* service : mock_services_) { | 95 for (BluetoothGattService* service : mock_services_) { |
80 if (service->GetIdentifier() == identifier) | 96 if (service->GetIdentifier() == identifier) |
81 return service; | 97 return service; |
82 } | 98 } |
83 return nullptr; | 99 return nullptr; |
84 } | 100 } |
85 | 101 |
86 } // namespace device | 102 } // namespace device |
OLD | NEW |