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 "device/bluetooth/test/mock_bluetooth_advertisement.h" | 7 #include "device/bluetooth/test/mock_bluetooth_advertisement.h" |
8 | 8 |
9 namespace device { | 9 namespace device { |
10 | 10 |
11 using testing::Invoke; | 11 using testing::Invoke; |
12 using testing::_; | 12 using testing::_; |
13 | 13 |
14 MockBluetoothAdapter::Observer::Observer() {} | 14 MockBluetoothAdapter::Observer::Observer() {} |
15 MockBluetoothAdapter::Observer::~Observer() {} | 15 MockBluetoothAdapter::Observer::~Observer() {} |
16 | 16 |
17 MockBluetoothAdapter::MockBluetoothAdapter() { | 17 MockBluetoothAdapter::MockBluetoothAdapter() { |
18 ON_CALL(*this, AddObserver(_)) | 18 ON_CALL(*this, AddObserver(_)) |
19 .WillByDefault(Invoke([this](BluetoothAdapter::Observer* observer) { | 19 .WillByDefault(Invoke([this](BluetoothAdapter::Observer* observer) { |
20 this->BluetoothAdapter::AddObserver(observer); | 20 this->BluetoothAdapter::AddObserver(observer); |
21 })); | 21 })); |
22 ON_CALL(*this, RemoveObserver(_)) | 22 ON_CALL(*this, RemoveObserver(_)) |
23 .WillByDefault(Invoke([this](BluetoothAdapter::Observer* observer) { | 23 .WillByDefault(Invoke([this](BluetoothAdapter::Observer* observer) { |
24 this->BluetoothAdapter::RemoveObserver(observer); | 24 this->BluetoothAdapter::RemoveObserver(observer); |
25 })); | 25 })); |
26 } | 26 } |
27 | 27 |
28 MockBluetoothAdapter::~MockBluetoothAdapter() {} | 28 MockBluetoothAdapter::~MockBluetoothAdapter() {} |
29 | 29 |
30 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) || defined(OS_LINUX) |
31 void MockBluetoothAdapter::Shutdown() { | 31 void MockBluetoothAdapter::Shutdown() { |
32 } | 32 } |
33 #endif | 33 #endif |
34 | 34 |
35 void MockBluetoothAdapter::AddDiscoverySession( | 35 void MockBluetoothAdapter::AddDiscoverySession( |
36 BluetoothDiscoveryFilter* discovery_filter, | 36 BluetoothDiscoveryFilter* discovery_filter, |
37 const base::Closure& callback, | 37 const base::Closure& callback, |
38 const DiscoverySessionErrorCallback& error_callback) {} | 38 const DiscoverySessionErrorCallback& error_callback) {} |
39 | 39 |
40 void MockBluetoothAdapter::RemoveDiscoverySession( | 40 void MockBluetoothAdapter::RemoveDiscoverySession( |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 | 80 |
81 void MockBluetoothAdapter::RegisterAdvertisement( | 81 void MockBluetoothAdapter::RegisterAdvertisement( |
82 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, | 82 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, |
83 const CreateAdvertisementCallback& callback, | 83 const CreateAdvertisementCallback& callback, |
84 const CreateAdvertisementErrorCallback& error_callback) { | 84 const CreateAdvertisementErrorCallback& error_callback) { |
85 callback.Run(new MockBluetoothAdvertisement); | 85 callback.Run(new MockBluetoothAdvertisement); |
86 } | 86 } |
87 | 87 |
88 } // namespace device | 88 } // namespace device |
OLD | NEW |