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

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: execute delayed when setting delay to 0 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
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..b7923ccc214ef5817de446c1e063448522f78c65 100644
--- a/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h
+++ b/chromeos/dbus/fake_bluetooth_gatt_characteristic_client.h
@@ -73,6 +73,22 @@ 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_; }
+
// 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 +126,9 @@ 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_;
+
// Total calories burned, used for the Heart Rate Measurement characteristic.
uint16 calories_burned_;
@@ -127,6 +146,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, struct DelayedCallback*> action_extra_requests_;
armansito 2014/10/01 20:08:22 struct keyword not necessary
+
// List of observers interested in event notifications from us.
ObserverList<Observer> observers_;

Powered by Google App Engine
This is Rietveld 408576698