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

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

Issue 642613002: Use Sync FakeServer in exponential backoff tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « chrome/browser/sync/test/integration/sync_test.cc ('k') | sync/test/fake_server/fake_server.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d9a2b8befe6167c43f1a71afe50d3e0183122c6c 100644
--- a/sync/test/fake_server/fake_server.h
+++ b/sync/test/fake_server/fake_server.h
@@ -94,6 +94,13 @@ class FakeServer {
// must be called if AddObserver was ever called with |observer|.
void RemoveObserver(Observer* observer);
+ // Undoes the effects of DisableNetwork.
+ void EnableNetwork();
+
+ // Forces every request to fail in a way that simulates a network failure.
+ // This can be used to trigger exponential backoff in the client.
+ void DisableNetwork();
+
private:
typedef std::map<std::string, FakeServerEntity*> EntityMap;
@@ -168,6 +175,10 @@ class FakeServer {
// FakeServer's observers.
ObserverList<Observer, true> observers_;
+
+ // When true, the server operates normally. When false, a failure is returned
+ // on every request. This is used to simulate a network failure on the client.
+ bool network_enabled_;
};
} // namespace fake_server
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | sync/test/fake_server/fake_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698