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

Unified Diff: sync/tools/testserver/chromiumsync.py

Issue 19309002: sync: Add pre-commit update avoidance mode + flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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: sync/tools/testserver/chromiumsync.py
diff --git a/sync/tools/testserver/chromiumsync.py b/sync/tools/testserver/chromiumsync.py
index 7aac4deeaa4389f39df7eb7d72a5fb24a43d9814..749bbec6981d88f807c69232b29d4f0b98a2f46d 100644
--- a/sync/tools/testserver/chromiumsync.py
+++ b/sync/tools/testserver/chromiumsync.py
@@ -131,6 +131,7 @@ KEYSTORE_KEY_LENGTH = 16
# The hashed client tag for the keystore encryption experiment node.
KEYSTORE_ENCRYPTION_EXPERIMENT_TAG = "pis8ZRzh98/MKLtVEio2mr42LQA="
+PRE_COMMIT_GU_AVOIDANCE_EXPERIMENT_TAG = "Z1xgeh3QUBa50vdEPd8C/4c7jfE="
Nicolas Zea 2013/07/16 00:24:32 Newline above this and add comment (it's not assoc
rlarocque 2013/07/16 01:08:27 Done.
class Error(Exception):
"""Error class for this module."""
@@ -1101,6 +1102,25 @@ class SyncDataModel(object):
user.specifics.managed_user.acknowledged = True
self._SaveEntry(user)
+ def TriggerEnablePreCommitGetUpdateAvoidance(self):
+ """Sets the experiment to enable pre-commit GetUpdate avoidance."""
+ experiment_id = self._ServerTagToId("google_chrome_experiments")
+ pre_commit_gu_avoidance_id = self._ClientTagToId(
+ EXPERIMENTS,
+ PRE_COMMIT_GU_AVOIDANCE_EXPERIMENT_TAG)
+ entry = self._entries.get(pre_commit_gu_avoidance_id)
+ if entry is None:
+ entry = sync_pb2.SyncEntity()
+ entry.id_string = pre_commit_gu_avoidance_id
+ entry.name = "Pre-commit GU avoidance"
+ entry.client_defined_unique_tag = PRE_COMMIT_GU_AVOIDANCE_EXPERIMENT_TAG
+ entry.folder = False
+ entry.deleted = False
+ entry.specifics.CopyFrom(GetDefaultEntitySpecifics(EXPERIMENTS))
+ self._WritePosition(entry, experiment_id)
+ entry.specifics.experiments.pre_commit_update_avoidance.enabled = True
+ self._SaveEntry(entry)
+
def SetInducedError(self, error, error_frequency,
sync_count_before_errors):
self.induced_error = error
@@ -1281,6 +1301,14 @@ class TestServer(object):
'<html><title>Enable Managed User Acknowledgement</title>'
'<h1>Enable Managed User Acknowledgement</h1></html>')
+ def HandleEnablePreCommitGetUpdateAvoidance(self):
+ """Enables the pre-commit GU avoidance experiment."""
+ self.account.TriggerEnablePreCommitGetUpdateAvoidance()
+ return (
+ 200,
+ '<html><title>Enable pre-commit GU avoidance</title>'
+ '<H1>Enable pre-commit GU avoidance</H1></html>')
+
def HandleCommand(self, query, raw_request):
"""Decode and handle a sync command from a raw input of bytes.

Powered by Google App Engine
This is Rietveld 408576698