Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(378)

Unified Diff: chromeos/dbus/fake_bluetooth_device_client.h

Issue 1258783009: Add functionality to Bluetooth settings UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/fake_bluetooth_device_client.h
diff --git a/chromeos/dbus/fake_bluetooth_device_client.h b/chromeos/dbus/fake_bluetooth_device_client.h
index a9e6c19bec8ea6c3118adff30b262e7bcc0e80a7..ba8c77a7de21afa323f15cbfe6ad0fdd4391e079 100644
--- a/chromeos/dbus/fake_bluetooth_device_client.h
+++ b/chromeos/dbus/fake_bluetooth_device_client.h
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/containers/scoped_ptr_map.h"
#include "base/observer_list.h"
#include "chromeos/chromeos_export.h"
#include "chromeos/dbus/bluetooth_agent_service_provider.h"
@@ -38,6 +39,27 @@ class CHROMEOS_EXPORT FakeBluetoothDeviceClient
dbus::PropertySet::SetCallback callback) override;
};
+ struct SimulatedPairingOptions {
+ std::string pairing_method;
+ std::string pairing_auth_token;
+ };
+
+ // Stores properties of a device that is about to be
+ // created.
+ struct IncomingDeviceProperties {
+ IncomingDeviceProperties();
+ ~IncomingDeviceProperties();
+
+ std::string device_name;
+ std::string device_alias;
+ std::string device_address;
+ std::string device_path;
+ std::string pairing_method;
+ std::string pairing_auth_token;
+ int device_class;
+ bool is_trusted;
+ };
+
FakeBluetoothDeviceClient();
~FakeBluetoothDeviceClient() override;
@@ -86,6 +108,13 @@ class CHROMEOS_EXPORT FakeBluetoothDeviceClient
void CreateDevice(const dbus::ObjectPath& adapter_path,
const dbus::ObjectPath& device_path);
+ // Creates a device with the given properties.
+ void CreateDeviceWithProperties(const dbus::ObjectPath& adapter_path,
+ const IncomingDeviceProperties& props);
+
+ SimulatedPairingOptions* GetPairingOptions(
+ const dbus::ObjectPath& object_path);
+
// Removes a device from the set we return for the given adapter.
void RemoveDevice(const dbus::ObjectPath& adapter_path,
const dbus::ObjectPath& device_path);
@@ -246,11 +275,18 @@ class CHROMEOS_EXPORT FakeBluetoothDeviceClient
// List of observers interested in event notifications from us.
base::ObserverList<Observer> observers_;
- // Static properties we return.
- typedef std::map<const dbus::ObjectPath, Properties *> PropertiesMap;
+ typedef base::ScopedPtrMap<const dbus::ObjectPath, scoped_ptr<Properties>>
+ PropertiesMap;
oshima 2015/07/31 14:54:56 using PropertiesMap = base....; (C++11 style)
rfrappier 2015/07/31 15:45:09 Done.
PropertiesMap properties_map_;
std::vector<dbus::ObjectPath> device_list_;
+ // Properties which are used to decied which method of pairing should
+ // be done on request.
+ typedef base::ScopedPtrMap<const dbus::ObjectPath,
+ scoped_ptr<SimulatedPairingOptions>>
+ PairingOptionsMap;
oshima 2015/07/31 14:54:56 ditto
rfrappier 2015/07/31 15:45:09 Done.
+ PairingOptionsMap pairing_options_map_;
+
int simulation_interval_ms_;
uint32_t discovery_simulation_step_;
uint32_t incoming_pairing_simulation_step_;

Powered by Google App Engine
This is Rietveld 408576698