| 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.
|
|
|
|
|