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_adapter.h" | 5 #include "device/bluetooth/test/mock_bluetooth_adapter.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "build/build_config.h" | 9 #include "build/build_config.h" |
8 #include "device/bluetooth/test/mock_bluetooth_advertisement.h" | 10 #include "device/bluetooth/test/mock_bluetooth_advertisement.h" |
9 | 11 |
10 namespace device { | 12 namespace device { |
11 | 13 |
12 using testing::Invoke; | 14 using testing::Invoke; |
13 using testing::_; | 15 using testing::_; |
14 | 16 |
15 MockBluetoothAdapter::Observer::Observer() {} | 17 MockBluetoothAdapter::Observer::Observer() {} |
16 MockBluetoothAdapter::Observer::~Observer() {} | 18 MockBluetoothAdapter::Observer::~Observer() {} |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void MockBluetoothAdapter::StartDiscoverySessionWithFilter( | 55 void MockBluetoothAdapter::StartDiscoverySessionWithFilter( |
54 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, | 56 scoped_ptr<BluetoothDiscoveryFilter> discovery_filter, |
55 const DiscoverySessionCallback& callback, | 57 const DiscoverySessionCallback& callback, |
56 const ErrorCallback& error_callback) { | 58 const ErrorCallback& error_callback) { |
57 StartDiscoverySessionWithFilterRaw(discovery_filter.get(), callback, | 59 StartDiscoverySessionWithFilterRaw(discovery_filter.get(), callback, |
58 error_callback); | 60 error_callback); |
59 } | 61 } |
60 | 62 |
61 void MockBluetoothAdapter::AddMockDevice( | 63 void MockBluetoothAdapter::AddMockDevice( |
62 scoped_ptr<MockBluetoothDevice> mock_device) { | 64 scoped_ptr<MockBluetoothDevice> mock_device) { |
63 mock_devices_.push_back(mock_device.Pass()); | 65 mock_devices_.push_back(std::move(mock_device)); |
64 } | 66 } |
65 | 67 |
66 BluetoothAdapter::ConstDeviceList MockBluetoothAdapter::GetConstMockDevices() { | 68 BluetoothAdapter::ConstDeviceList MockBluetoothAdapter::GetConstMockDevices() { |
67 BluetoothAdapter::ConstDeviceList devices; | 69 BluetoothAdapter::ConstDeviceList devices; |
68 for (auto& it : mock_devices_) { | 70 for (auto& it : mock_devices_) { |
69 devices.push_back(it); | 71 devices.push_back(it); |
70 } | 72 } |
71 return devices; | 73 return devices; |
72 } | 74 } |
73 | 75 |
74 BluetoothAdapter::DeviceList MockBluetoothAdapter::GetMockDevices() { | 76 BluetoothAdapter::DeviceList MockBluetoothAdapter::GetMockDevices() { |
75 BluetoothAdapter::DeviceList devices; | 77 BluetoothAdapter::DeviceList devices; |
76 for (auto& it : mock_devices_) { | 78 for (auto& it : mock_devices_) { |
77 devices.push_back(it); | 79 devices.push_back(it); |
78 } | 80 } |
79 return devices; | 81 return devices; |
80 } | 82 } |
81 | 83 |
82 void MockBluetoothAdapter::RegisterAdvertisement( | 84 void MockBluetoothAdapter::RegisterAdvertisement( |
83 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, | 85 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, |
84 const CreateAdvertisementCallback& callback, | 86 const CreateAdvertisementCallback& callback, |
85 const CreateAdvertisementErrorCallback& error_callback) { | 87 const CreateAdvertisementErrorCallback& error_callback) { |
86 callback.Run(new MockBluetoothAdvertisement); | 88 callback.Run(new MockBluetoothAdvertisement); |
87 } | 89 } |
88 | 90 |
89 } // namespace device | 91 } // namespace device |
OLD | NEW |