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
3 // found in the LICENSE file.
5 #include "device/bluetooth/test/mock_bluetooth_adapter.h"
7 #include "device/bluetooth/test/mock_bluetooth_advertisement.h"
11 MockBluetoothAdapter::Observer::Observer() {}
12 MockBluetoothAdapter::Observer::~Observer() {}
14 MockBluetoothAdapter::MockBluetoothAdapter() {
17 MockBluetoothAdapter::~MockBluetoothAdapter() {}
19 #if defined(OS_CHROMEOS)
20 void MockBluetoothAdapter::Shutdown() {
24 void MockBluetoothAdapter::AddDiscoverySession(
25 BluetoothDiscoveryFilter
* discovery_filter
,
26 const base::Closure
& callback
,
27 const ErrorCallback
& error_callback
) {
30 void MockBluetoothAdapter::RemoveDiscoverySession(
31 BluetoothDiscoveryFilter
* discovery_filter
,
32 const base::Closure
& callback
,
33 const ErrorCallback
& error_callback
) {
36 void MockBluetoothAdapter::SetDiscoveryFilter(
37 scoped_ptr
<BluetoothDiscoveryFilter
> discovery_filter
,
38 const base::Closure
& callback
,
39 const ErrorCallback
& error_callback
) {
40 SetDiscoveryFilterRaw(discovery_filter
.get(), callback
, error_callback
);
43 void MockBluetoothAdapter::StartDiscoverySessionWithFilter(
44 scoped_ptr
<BluetoothDiscoveryFilter
> discovery_filter
,
45 const DiscoverySessionCallback
& callback
,
46 const ErrorCallback
& error_callback
) {
47 StartDiscoverySessionWithFilterRaw(discovery_filter
.get(), callback
,
51 void MockBluetoothAdapter::AddMockDevice(
52 scoped_ptr
<MockBluetoothDevice
> mock_device
) {
53 mock_devices_
.push_back(mock_device
.Pass());
56 BluetoothAdapter::ConstDeviceList
MockBluetoothAdapter::GetConstMockDevices() {
57 BluetoothAdapter::ConstDeviceList devices
;
58 for (auto& it
: mock_devices_
) {
59 devices
.push_back(it
);
64 BluetoothAdapter::DeviceList
MockBluetoothAdapter::GetMockDevices() {
65 BluetoothAdapter::DeviceList devices
;
66 for (auto& it
: mock_devices_
) {
67 devices
.push_back(it
);
72 void MockBluetoothAdapter::RegisterAdvertisement(
73 scoped_ptr
<BluetoothAdvertisement::Data
> advertisement_data
,
74 const CreateAdvertisementCallback
& callback
,
75 const CreateAdvertisementErrorCallback
& error_callback
) {
76 callback
.Run(new MockBluetoothAdvertisement
);