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

Unified Diff: chrome/browser/sync/internal_api/syncapi_unittest.cc

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: fix nigori access in testserver 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: chrome/browser/sync/internal_api/syncapi_unittest.cc
diff --git a/chrome/browser/sync/internal_api/syncapi_unittest.cc b/chrome/browser/sync/internal_api/syncapi_unittest.cc
index 9b941817fc47eedb1a73a95b9653e11bb91b8359..3b983ebb404400045af038609174625a96b90645 100644
--- a/chrome/browser/sync/internal_api/syncapi_unittest.cc
+++ b/chrome/browser/sync/internal_api/syncapi_unittest.cc
@@ -509,8 +509,7 @@ TEST_F(SyncApiTest, BaseNodeSetSpecifics) {
EXPECT_TRUE(node.InitByIdLookup(child_id));
sync_pb::EntitySpecifics entity_specifics;
- entity_specifics.MutableExtension(sync_pb::bookmark)->
- set_url("http://www.google.com");
+ entity_specifics.mutable_bookmark()->set_url("http://www.google.com");
EXPECT_NE(entity_specifics.SerializeAsString(),
node.GetEntitySpecifics().SerializeAsString());
@@ -528,8 +527,7 @@ TEST_F(SyncApiTest, BaseNodeSetSpecificsPreservesUnknownFields) {
EXPECT_TRUE(node.GetEntitySpecifics().unknown_fields().empty());
sync_pb::EntitySpecifics entity_specifics;
- entity_specifics.MutableExtension(sync_pb::bookmark)->
- set_url("http://www.google.com");
+ entity_specifics.mutable_bookmark()->set_url("http://www.google.com");
entity_specifics.mutable_unknown_fields()->AddFixed32(5, 100);
node.SetEntitySpecifics(entity_specifics);
EXPECT_FALSE(node.GetEntitySpecifics().unknown_fields().empty());
@@ -1822,7 +1820,7 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
EXPECT_TRUE(node.InitByIdLookup(node_id1));
sync_pb::EntitySpecifics entity_specifics;
- entity_specifics.MutableExtension(sync_pb::bookmark)->set_url(url);
+ entity_specifics.mutable_bookmark()->set_url(url);
node.SetEntitySpecifics(entity_specifics);
// Set the old style title.
@@ -1833,7 +1831,7 @@ TEST_F(SyncManagerTest, EncryptBookmarksWithLegacyData) {
EXPECT_TRUE(node2.InitByIdLookup(node_id2));
sync_pb::EntitySpecifics entity_specifics2;
- entity_specifics2.MutableExtension(sync_pb::bookmark)->set_url(url2);
+ entity_specifics2.mutable_bookmark()->set_url(url2);
node2.SetEntitySpecifics(entity_specifics2);
// Set the old style title.
@@ -1939,8 +1937,8 @@ TEST_F(SyncManagerTest, CreateLocalBookmark) {
TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
std::string client_tag = "title";
sync_pb::EntitySpecifics entity_specifics;
- entity_specifics.MutableExtension(sync_pb::bookmark)->set_url("url");
- entity_specifics.MutableExtension(sync_pb::bookmark)->set_title("title");
+ entity_specifics.mutable_bookmark()->set_url("url");
+ entity_specifics.mutable_bookmark()->set_title("title");
MakeServerNode(sync_manager_.GetUserShare(), syncable::BOOKMARKS, client_tag,
BaseNode::GenerateSyncableHash(syncable::BOOKMARKS,
client_tag),
@@ -2048,8 +2046,8 @@ TEST_F(SyncManagerTest, UpdateEntryWithEncryption) {
// Manually change to different data. Should set is_unsynced.
{
- entity_specifics.MutableExtension(sync_pb::bookmark)->set_url("url2");
- entity_specifics.MutableExtension(sync_pb::bookmark)->set_title("title2");
+ entity_specifics.mutable_bookmark()->set_url("url2");
+ entity_specifics.mutable_bookmark()->set_title("title2");
WriteTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
WriteNode node(&trans);
EXPECT_TRUE(node.InitByClientTagLookup(syncable::BOOKMARKS, client_tag));
@@ -2078,7 +2076,7 @@ TEST_F(SyncManagerTest, UpdatePasswordSetEntitySpecificsNoChange) {
data.set_password_value("secret");
cryptographer->Encrypt(
data,
- entity_specifics.MutableExtension(sync_pb::password)->
+ entity_specifics.mutable_password()->
mutable_encrypted());
}
MakeServerNode(sync_manager_.GetUserShare(), syncable::PASSWORDS, client_tag,
@@ -2112,7 +2110,7 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) {
data.set_password_value("secret");
cryptographer->Encrypt(
data,
- entity_specifics.MutableExtension(sync_pb::password)->
+ entity_specifics.mutable_password()->
mutable_encrypted());
}
MakeServerNode(sync_manager_.GetUserShare(), syncable::PASSWORDS, client_tag,
@@ -2142,8 +2140,7 @@ TEST_F(SyncManagerTest, UpdatePasswordSetPasswordSpecifics) {
data.set_password_value("secret2");
cryptographer->Encrypt(
data,
- entity_specifics.MutableExtension(sync_pb::password)->
- mutable_encrypted());
+ entity_specifics.mutable_password()->mutable_encrypted());
node.SetPasswordSpecifics(data);
const syncable::Entry* node_entry = node.GetEntry();
EXPECT_TRUE(node_entry->Get(IS_UNSYNCED));
@@ -2163,8 +2160,7 @@ TEST_F(SyncManagerTest, UpdatePasswordNewPassphrase) {
data.set_password_value("secret");
cryptographer->Encrypt(
data,
- entity_specifics.MutableExtension(sync_pb::password)->
- mutable_encrypted());
+ entity_specifics.mutable_password()->mutable_encrypted());
}
MakeServerNode(sync_manager_.GetUserShare(), syncable::PASSWORDS, client_tag,
BaseNode::GenerateSyncableHash(syncable::PASSWORDS,
@@ -2195,8 +2191,7 @@ TEST_F(SyncManagerTest, UpdatePasswordReencryptEverything) {
data.set_password_value("secret");
cryptographer->Encrypt(
data,
- entity_specifics.MutableExtension(sync_pb::password)->
- mutable_encrypted());
+ entity_specifics.mutable_password()->mutable_encrypted());
}
MakeServerNode(sync_manager_.GetUserShare(), syncable::PASSWORDS, client_tag,
BaseNode::GenerateSyncableHash(syncable::PASSWORDS,
@@ -2223,8 +2218,8 @@ TEST_F(SyncManagerTest, UpdatePasswordReencryptEverything) {
TEST_F(SyncManagerTest, SetBookmarkTitle) {
std::string client_tag = "title";
sync_pb::EntitySpecifics entity_specifics;
- entity_specifics.MutableExtension(sync_pb::bookmark)->set_url("url");
- entity_specifics.MutableExtension(sync_pb::bookmark)->set_title("title");
+ entity_specifics.mutable_bookmark()->set_url("url");
+ entity_specifics.mutable_bookmark()->set_title("title");
MakeServerNode(sync_manager_.GetUserShare(), syncable::BOOKMARKS, client_tag,
BaseNode::GenerateSyncableHash(syncable::BOOKMARKS,
client_tag),
@@ -2257,8 +2252,8 @@ TEST_F(SyncManagerTest, SetBookmarkTitle) {
TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) {
std::string client_tag = "title";
sync_pb::EntitySpecifics entity_specifics;
- entity_specifics.MutableExtension(sync_pb::bookmark)->set_url("url");
- entity_specifics.MutableExtension(sync_pb::bookmark)->set_title("title");
+ entity_specifics.mutable_bookmark()->set_url("url");
+ entity_specifics.mutable_bookmark()->set_title("title");
MakeServerNode(sync_manager_.GetUserShare(), syncable::BOOKMARKS, client_tag,
BaseNode::GenerateSyncableHash(syncable::BOOKMARKS,
client_tag),
@@ -2315,8 +2310,8 @@ TEST_F(SyncManagerTest, SetBookmarkTitleWithEncryption) {
TEST_F(SyncManagerTest, SetNonBookmarkTitle) {
std::string client_tag = "title";
sync_pb::EntitySpecifics entity_specifics;
- entity_specifics.MutableExtension(sync_pb::preference)->set_name("name");
- entity_specifics.MutableExtension(sync_pb::preference)->set_value("value");
+ entity_specifics.mutable_preference()->set_name("name");
+ entity_specifics.mutable_preference()->set_value("value");
MakeServerNode(sync_manager_.GetUserShare(),
syncable::PREFERENCES,
client_tag,
@@ -2351,8 +2346,8 @@ TEST_F(SyncManagerTest, SetNonBookmarkTitle) {
TEST_F(SyncManagerTest, SetNonBookmarkTitleWithEncryption) {
std::string client_tag = "title";
sync_pb::EntitySpecifics entity_specifics;
- entity_specifics.MutableExtension(sync_pb::preference)->set_name("name");
- entity_specifics.MutableExtension(sync_pb::preference)->set_value("value");
+ entity_specifics.mutable_preference()->set_name("name");
+ entity_specifics.mutable_preference()->set_value("value");
MakeServerNode(sync_manager_.GetUserShare(),
syncable::PREFERENCES,
client_tag,
@@ -2420,8 +2415,8 @@ TEST_F(SyncManagerTest, SetPreviouslyEncryptedSpecifics) {
ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare());
browser_sync::Cryptographer* crypto = trans.GetCryptographer();
sync_pb::EntitySpecifics bm_specifics;
- bm_specifics.MutableExtension(sync_pb::bookmark)->set_title("title");
- bm_specifics.MutableExtension(sync_pb::bookmark)->set_url("url");
+ bm_specifics.mutable_bookmark()->set_title("title");
+ bm_specifics.mutable_bookmark()->set_url("url");
sync_pb::EncryptedData encrypted;
crypto->Encrypt(bm_specifics, &encrypted);
entity_specifics.mutable_encrypted()->CopyFrom(encrypted);

Powered by Google App Engine
This is Rietveld 408576698