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

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

Issue 9460047: sync: remove use of protobuf extensions in protocol to reduce static init overhead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nick's comment Created 8 years, 10 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: net/tools/testserver/chromiumsync_test.py
diff --git a/net/tools/testserver/chromiumsync_test.py b/net/tools/testserver/chromiumsync_test.py
index d704ac3ee2de2700764e072dd48d96908a1ed207..b91fbfad0f4468660f94cb22c0eb64b15f7e8cc6 100755
--- a/net/tools/testserver/chromiumsync_test.py
+++ b/net/tools/testserver/chromiumsync_test.py
@@ -14,6 +14,8 @@ import chromiumsync
import sync_pb2
import theme_specifics_pb2
+from google.protobuf import text_format
ncarter (slow) 2012/03/01 22:13:05 Debugging cruft; remove these lines.
akalin 2012/03/02 23:56:49 not removed yet?
+
class SyncDataModelTest(unittest.TestCase):
def setUp(self):
self.model = chromiumsync.SyncDataModel()
@@ -25,8 +27,9 @@ class SyncDataModelTest(unittest.TestCase):
message = sync_pb2.GetUpdatesMessage()
message.from_timestamp = timestamp
for data_type in requested_types:
- message.requested_types.Extensions[
- chromiumsync.SYNC_TYPE_TO_EXTENSION[data_type]].SetInParent()
+ getattr(message.requested_types,
+ chromiumsync.SYNC_TYPE_TO_DESCRIPTOR[
+ data_type].name).SetInParent()
return self.model.GetChanges(
chromiumsync.UpdateSieve(message, self.model.migration_history))
@@ -298,12 +301,12 @@ class SyncDataModelTest(unittest.TestCase):
def testUpdateSieve(self):
# from_timestamp, legacy mode
- autofill = autofill_specifics_pb2.autofill
- theme = theme_specifics_pb2.theme
+ autofill = chromiumsync.SYNC_TYPE_FIELDS['autofill']
+ theme = chromiumsync.SYNC_TYPE_FIELDS['theme']
msg = sync_pb2.GetUpdatesMessage()
msg.from_timestamp = 15412
- msg.requested_types.Extensions[autofill].SetInParent()
- msg.requested_types.Extensions[theme].SetInParent()
+ msg.requested_types.autofill.SetInParent()
+ msg.requested_types.theme.SetInParent()
sieve = chromiumsync.UpdateSieve(msg)
self.assertEqual(sieve._state,
@@ -448,8 +451,8 @@ class SyncDataModelTest(unittest.TestCase):
self.assertTrue(testserver.transient_error)
def testUpdateSieveStoreMigration(self):
- autofill = autofill_specifics_pb2.autofill
- theme = theme_specifics_pb2.theme
+ autofill = chromiumsync.SYNC_TYPE_FIELDS['autofill']
+ theme = chromiumsync.SYNC_TYPE_FIELDS['theme']
migrator = chromiumsync.MigrationHistory()
msg = sync_pb2.GetUpdatesMessage()
marker = msg.from_progress_marker.add()
« net/tools/testserver/chromiumsync.py ('K') | « net/tools/testserver/chromiumsync.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698