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

Unified Diff: chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h

Issue 619973002: Add unit testing for more org.bluez.Error.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments, add remaining tests Created 6 years, 3 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
« no previous file with comments | « no previous file | chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h
diff --git a/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h
index 12be69d89df26ce5597d55ad3a3b758c8664d635..fc17614f207578ce863b0b7218c3b33b4bec01fe 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h
+++ b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h
@@ -73,6 +73,29 @@ class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicClient
// performs the appropriate assertions.
bool IsHeartRateVisible() const;
+ // Makes this characteristic client really slow.
+ // So slow, that it is guaranteed that |requests| requests will
+ // come in while the client is doing the previous request.
+ // Setting |requests| to zero will cause all delayed actions to
+ // complete immediately.
+ void SetExtraProcessing(size_t requests);
+
+ size_t GetExtraProcessing() const;
+
+ // Sets whether the client is authorized or not.
+ // Defaults to authorized.
+ void SetAuthorized(bool authorized) { authorized_ = authorized; }
+
+ // Get the current Authorization state.
+ bool IsAuthorized() const { return authorized_; }
+
+ // Whether the client is Authenticated
+ // Defaults to authenticated.
+ void SetAuthenticated(bool authenticated) { authenticated_ = authenticated; }
+
+ // Get the current Authenticated state.
+ bool IsAuthenticated() const { return authenticated_; }
+
// Returns the current object paths of exposed characteristics. If the
// characteristic is not visible, returns an invalid empty path.
dbus::ObjectPath GetHeartRateMeasurementPath() const;
@@ -110,6 +133,12 @@ class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicClient
// IsHeartRateVisible() to check the value.
bool heart_rate_visible_;
+ // If true, the client is authorized to read and write.
+ bool authorized_;
+
+ // If true, the client is authenticated.
+ bool authenticated_;
+
// Total calories burned, used for the Heart Rate Measurement characteristic.
uint16 calories_burned_;
@@ -127,6 +156,22 @@ class CHROMEOS_EXPORT FakeBluetoothGattCharacteristicClient
std::string body_sensor_location_path_;
std::string heart_rate_control_point_path_;
+ // Number of extra requests that need to come in simulating slowness.
+ size_t extra_requests_;
+
+ // Current countdowns for extra requests for various actions.
+ struct DelayedCallback {
+ public:
+ DelayedCallback(base::Closure callback, size_t delay);
+ ~DelayedCallback();
+
+ base::Closure callback_;
+ size_t delay_;
+ };
+
+ // Map of delayed callbacks.
+ std::map<std::string, DelayedCallback*> action_extra_requests_;
armansito 2014/10/01 22:25:54 Make sure to delete these in the destructor.
+
// List of observers interested in event notifications from us.
ObserverList<Observer> observers_;
« no previous file with comments | « no previous file | chromeos/dbus/fake_bluetooth_gatt_characteristic_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698