summaryrefslogtreecommitdiffstats
path: root/net/tools/testserver/chromiumsync.py
diff options
context:
space:
mode:
authorlipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-30 02:17:37 +0000
committerlipalani@chromium.org <lipalani@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-30 02:17:37 +0000
commita887390640cf23cea3c5c97840744d5eaf145f7f (patch)
tree359dd6073f6fe92daac3fa9579b8fa8ac025df6e /net/tools/testserver/chromiumsync.py
parent153b8f2a9522b68ee55941164e6bda5a5cbfd6bf (diff)
downloadchromium_src-a887390640cf23cea3c5c97840744d5eaf145f7f.zip
chromium_src-a887390640cf23cea3c5c97840744d5eaf145f7f.tar.gz
chromium_src-a887390640cf23cea3c5c97840744d5eaf145f7f.tar.bz2
Test birtday error.
BUG= TEST= Review URL: http://codereview.chromium.org/7481009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94818 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools/testserver/chromiumsync.py')
-rwxr-xr-xnet/tools/testserver/chromiumsync.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/net/tools/testserver/chromiumsync.py b/net/tools/testserver/chromiumsync.py
index 8257009..ac50e7d 100755
--- a/net/tools/testserver/chromiumsync.py
+++ b/net/tools/testserver/chromiumsync.py
@@ -407,8 +407,7 @@ class SyncDataModel(object):
# SyncEntity protocol buffer.
self._entries = {}
- # TODO(nick): uuid.uuid1() is better, but python 2.5 only.
- self.store_birthday = '%0.30f' % random.random()
+ self.ResetStoreBirthday()
self.migration_history = MigrationHistory()
@@ -560,6 +559,15 @@ class SyncDataModel(object):
if spec.sync_type in requested_types:
self._CreatePermanentItem(spec)
+ def ResetStoreBirthday(self):
+ """Resets the store birthday to a random value."""
+ # TODO(nick): uuid.uuid1() is better, but python 2.5 only.
+ self.store_birthday = '%0.30f' % random.random()
+
+ def StoreBirthday(self):
+ """Gets the store birthday."""
+ return self.store_birthday
+
def GetChanges(self, sieve):
"""Get entries which have changed, oldest first.
@@ -884,7 +892,7 @@ class TestServer(object):
"""Raises StoreBirthdayError if the request's birthday is a mismatch."""
if not request.HasField('store_birthday'):
return
- if self.account.store_birthday != request.store_birthday:
+ if self.account.StoreBirthday() != request.store_birthday:
raise StoreBirthdayError
def HandleMigrate(self, path):
@@ -909,6 +917,12 @@ class TestServer(object):
return (code, '<html><title>Migration: %d</title><H1>%d %s</H1></html>' %
(code, code, response))
+ def HandleCreateBirthdayError(self):
+ self.account.ResetStoreBirthday()
+ return (
+ 200,
+ '<html><title>Birthday error</title><H1>Birthday error</H1></html>')
+
def HandleCommand(self, query, raw_request):
"""Decode and handle a sync command from a raw input of bytes.