OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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. |
| 4 |
| 5 #ifndef CHROMEOS_DBUS_FAKE_BLUETOOTH_ADVERTISEMENT_SERVICE_PROVIDER_H_ |
| 6 #define CHROMEOS_DBUS_FAKE_BLUETOOTH_ADVERTISEMENT_SERVICE_PROVIDER_H_ |
| 7 |
| 8 #include "base/bind.h" |
| 9 #include "base/callback.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chromeos/chromeos_export.h" |
| 12 #include "chromeos/dbus/bluetooth_advertisement_service_provider.h" |
| 13 #include "dbus/file_descriptor.h" |
| 14 #include "dbus/object_path.h" |
| 15 |
| 16 namespace chromeos { |
| 17 |
| 18 // FakeBluetoothAdvertisementServiceProvider simulates the behavior of a local |
| 19 // Bluetooth agent object and is used both in test cases in place of a |
| 20 // mock and on the Linux desktop. |
| 21 class CHROMEOS_EXPORT FakeBluetoothAdvertisementServiceProvider |
| 22 : public BluetoothAdvertisementServiceProvider { |
| 23 public: |
| 24 FakeBluetoothAdvertisementServiceProvider(const dbus::ObjectPath& object_path, |
| 25 Delegate* delegate); |
| 26 ~FakeBluetoothAdvertisementServiceProvider() override; |
| 27 |
| 28 // Each of these calls the equivalent |
| 29 // BluetoothAdvertisementServiceProvider::Delegate method on the object passed |
| 30 // on |
| 31 // construction. |
| 32 virtual void Release(); |
| 33 |
| 34 const dbus::ObjectPath& object_path() { return object_path_; } |
| 35 |
| 36 private: |
| 37 friend class FakeBluetoothAdvertisementManagerClient; |
| 38 |
| 39 // D-Bus object path we are faking. |
| 40 dbus::ObjectPath object_path_; |
| 41 |
| 42 // All incoming method calls are passed on to the Delegate and a callback |
| 43 // passed to generate the reply. |delegate_| is generally the object that |
| 44 // owns this one, and must outlive it. |
| 45 Delegate* delegate_; |
| 46 }; |
| 47 |
| 48 } // namespace chromeos |
| 49 |
| 50 #endif // CHROMEOS_DBUS_FAKE_BLUETOOTH_ADVERTISEMENT_SERVICE_PROVIDER_H_ |
OLD | NEW |