Chromium Code Reviews| Index: net/tools/testserver/chromiumsync.py |
| diff --git a/net/tools/testserver/chromiumsync.py b/net/tools/testserver/chromiumsync.py |
| index fc1be200ec086d4bd2550265ef48aa67d61efe0b..240458677e4c81caae928725753f098878f8f7c1 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() |
| @@ -600,6 +599,17 @@ class SyncDataModel(object): |
| if spec.sync_type in requested_types: |
| self._CreatePermanentItem(spec) |
| + def ResetStoreBirthday(self): |
| + """Resets the store birthday to a random value. |
| + """ |
|
ncarter (slow)
2011/07/29 18:40:40
The closing """ should be on the prev line for a s
lipalani1
2011/07/29 19:33:24
Done.
|
| + # 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. |
| + """ |
|
ncarter (slow)
2011/07/29 18:40:40
Here too.
lipalani1
2011/07/29 19:33:24
Done.
|
| + return self.store_birthday |
| + |
| def GetChanges(self, sieve): |
| """Get entries which have changed, oldest first. |
| @@ -930,7 +940,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): |
| @@ -955,6 +965,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. |