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

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

Issue 7878005: [Sync] Fix encrypting of sync titles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and add comment Created 9 years, 3 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/browser/sync/engine/syncer_unittest.cc ('k') | chrome/browser/sync/internal_api/write_node.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8a9c9ce9b2405c9cde6d4f8c20b6198fcc89d1af..2e5a79dc049945b6a17cbca71b37462c1cb11fa3 100644
--- a/chrome/browser/sync/internal_api/syncapi_unittest.cc
+++ b/chrome/browser/sync/internal_api/syncapi_unittest.cc
@@ -68,6 +68,7 @@ using browser_sync::ModelSafeWorkerRegistrar;
using browser_sync::sessions::SyncSessionSnapshot;
using browser_sync::WeakHandle;
using syncable::GetAllRealModelTypes;
+using syncable::kEncryptedString;
using syncable::ModelType;
using syncable::ModelTypeSet;
using test::ExpectDictDictionaryValue;
@@ -402,6 +403,47 @@ TEST_F(SyncApiTest, WriteAndReadPassword) {
}
}
+TEST_F(SyncApiTest, WriteEncryptedTitle) {
+ KeyParams params = {"localhost", "username", "passphrase"};
+ {
+ ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
+ trans.GetCryptographer()->AddKey(params);
+ trans.GetCryptographer()->set_encrypt_everything();
+ }
+ {
+ WriteTransaction trans(FROM_HERE, test_user_share_.user_share());
+ ReadNode root_node(&trans);
+ root_node.InitByRootLookup();
+
+ WriteNode bookmark_node(&trans);
+ EXPECT_TRUE(bookmark_node.InitUniqueByCreation(syncable::BOOKMARKS,
+ root_node, "foo"));
+ bookmark_node.SetTitle(UTF8ToWide("foo"));
+
+ WriteNode pref_node(&trans);
+ EXPECT_TRUE(pref_node.InitUniqueByCreation(syncable::PREFERENCES,
+ root_node, "bar"));
+ pref_node.SetTitle(UTF8ToWide("bar"));
+ }
+ {
+ ReadTransaction trans(FROM_HERE, test_user_share_.user_share());
+ ReadNode root_node(&trans);
+ root_node.InitByRootLookup();
+
+ ReadNode bookmark_node(&trans);
+ EXPECT_TRUE(bookmark_node.InitByClientTagLookup(syncable::BOOKMARKS,
+ "foo"));
+ EXPECT_EQ("foo", bookmark_node.GetTitle());
+ EXPECT_EQ(kEncryptedString,
+ bookmark_node.GetEntry()->Get(syncable::NON_UNIQUE_NAME));
+
+ ReadNode pref_node(&trans);
+ EXPECT_TRUE(pref_node.InitByClientTagLookup(syncable::PREFERENCES,
+ "bar"));
+ EXPECT_EQ(kEncryptedString, pref_node.GetTitle());
+ }
+}
+
TEST_F(SyncApiTest, BaseNodeSetSpecifics) {
int64 child_id = MakeNode(test_user_share_.user_share(),
syncable::BOOKMARKS, "testtag");
« no previous file with comments | « chrome/browser/sync/engine/syncer_unittest.cc ('k') | chrome/browser/sync/internal_api/write_node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698