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

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

Issue 7481009: Test birtday error. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Upload before commit. Created 9 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
« no previous file with comments | « chrome/test/live_sync/sync_errors_test.cc ('k') | net/tools/testserver/testserver.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/testserver/chromiumsync.py
diff --git a/net/tools/testserver/chromiumsync.py b/net/tools/testserver/chromiumsync.py
index 825700986ef7c0b527693986227dd1a5ad1b8a9c..ac50e7dab1408791df59770f30bf491f994001c0 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.
« no previous file with comments | « chrome/test/live_sync/sync_errors_test.cc ('k') | net/tools/testserver/testserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698