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

Unified Diff: components/sync/test/fake_server/fake_server.h

Issue 2973833002: [Sync] Added integ tests to verify UserEvents retry on TRANSIENT_ERROR. (Closed)
Patch Set: Created 3 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: components/sync/test/fake_server/fake_server.h
diff --git a/components/sync/test/fake_server/fake_server.h b/components/sync/test/fake_server/fake_server.h
index b37a00c1449d229e9dc65d58e1edcab3d7d09671..9cd8ed5ca5b0bf00385333410e93491a4fa8add8 100644
--- a/components/sync/test/fake_server/fake_server.h
+++ b/components/sync/test/fake_server/fake_server.h
@@ -146,6 +146,18 @@ class FakeServer {
// Returns the current FakeServer as a WeakPtr.
base::WeakPtr<FakeServer> AsWeakPtr();
+ using ResponseTypeProvider =
+ base::RepeatingCallback<sync_pb::CommitResponse::ResponseType(
+ const FakeServerEntity& entity)>;
+
+ // Use this callback to generate response types for entities. They will still
+ // be "committed" and stored as normal, this only affects the response type
+ // the client sees. This allows tests to still inspect what the client has
+ // done, although not as useful of a mechanism for multi client tests. Care
+ // should be taken when failing responses, as the client will go into
+ // exponential backoff, which can cause tests to be slow or time out.
+ void OverrideResponseType(ResponseTypeProvider response_type_override);
+
private:
using EntityMap = std::map<std::string, std::unique_ptr<FakeServerEntity>>;
@@ -255,6 +267,8 @@ class FakeServer {
sync_pb::ClientToServerMessage last_commit_message_;
sync_pb::ClientToServerMessage last_getupdates_message_;
+ ResponseTypeProvider response_type_override_;
+
// Used to verify that FakeServer is only used from one thread.
base::ThreadChecker thread_checker_;

Powered by Google App Engine
This is Rietveld 408576698