Index: sync/test/fake_server/fake_server.h |
diff --git a/sync/test/fake_server/fake_server.h b/sync/test/fake_server/fake_server.h |
index 15ad0e0633da5aa3816e873b6fc6f9bd4c5fed97..a5e147e495c28317d6a5d9db075b1dde937399a3 100644 |
--- a/sync/test/fake_server/fake_server.h |
+++ b/sync/test/fake_server/fake_server.h |
@@ -72,20 +72,26 @@ class FakeServer { |
// Force the server to return |error_type| in the error_code field of |
// ClientToServerResponse on all subsequent sync requests. This method should |
- // not be called if TriggerActionableError has previously been called. |
- // TODO(pvalenzuela): Return a bool here to indicate whether the call |
- // succeeded. |
- void TriggerError(const sync_pb::SyncEnums::ErrorType& error_type); |
+ // not be called if TriggerActionableError has previously been called. Returns |
+ // true if error triggering was successfully configured. |
+ bool TriggerError(const sync_pb::SyncEnums::ErrorType& error_type); |
// Force the server to return the given data as part of the error field of |
// ClientToServerResponse on all subsequent sync requests. This method should |
- // not be called if TriggerError has previously been called. |
+ // not be called if TriggerError has previously been called. Returns true if |
+ // error triggering was successfully configured. |
bool TriggerActionableError( |
const sync_pb::SyncEnums::ErrorType& error_type, |
const std::string& description, |
const std::string& url, |
const sync_pb::SyncEnums::Action& action); |
+ // Instructs the server to send triggered errors on every other request |
+ // (starting with the first one after this call). This method should only be |
+ // called after a call to TriggerError or TriggerActionableError. Returns true |
+ // if triggered error alternating was successful. |
Nicolas Zea
2014/10/10 23:51:09
Comment why you might want to use this?
pval...(no longer on Chromium)
2014/10/14 17:26:04
Done.
|
+ bool EnableAlternatingTriggeredErrors(); |
+ |
// Adds |observer| to FakeServer's observer list. This should be called |
// before the Profile associated with |observer| is connected to the server. |
void AddObserver(Observer* observer); |
@@ -140,6 +146,9 @@ class FakeServer { |
// |id|. A tombstone is not created for the entity itself. |
bool DeleteChildren(const std::string& id); |
+ // Returns whether a triggered error should be sent for the request. |
+ bool ShouldSendTriggeredError() const; |
+ |
// This is the last version number assigned to an entity. The next entity will |
// have a version number of version_ + 1. |
int64 version_; |
@@ -166,6 +175,16 @@ class FakeServer { |
// NULL. |
scoped_ptr<sync_pb::ClientToServerResponse_Error> triggered_actionable_error_; |
+ // These values are used in tandem to return a triggered error (either |
+ // |error_type_| or |triggered_actionable_error_|) on every other request. |
+ // |alternate_triggered_errors_| is set if this feature is enabled and |
+ // |request_counter_| is used to send triggered errors on odd-numbered |
+ // requests. Note that |request_counter_| can be reset and is not necessarily |
+ // indicative of the total number of requests handled during the object's |
+ // lifetime. |
+ bool alternate_triggered_errors_; |
+ int request_counter_; |
+ |
// FakeServer's observers. |
ObserverList<Observer, true> observers_; |
}; |