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

Unified Diff: sync/engine/syncer_unittest.cc

Issue 10844005: [Sync] Refactor GetEncryptedTypes usage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + add dcheck Created 8 years, 4 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 | « sync/engine/get_commit_ids_command.cc ('k') | sync/engine/syncer_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/syncer_unittest.cc
diff --git a/sync/engine/syncer_unittest.cc b/sync/engine/syncer_unittest.cc
index 506fa3f76223212b11edbb55a87ddbae4bf67adc..df587a77288e94040a28d6a1c66fd948e537b629 100644
--- a/sync/engine/syncer_unittest.cc
+++ b/sync/engine/syncer_unittest.cc
@@ -256,7 +256,6 @@ class SyncerTest : public testing::Test,
child_id_ = ids_.MakeServer("child id");
directory()->set_store_birthday(mock_server_->store_birthday());
mock_server_->SetKeystoreKey("encryption_key");
- GetCryptographer(&trans)->SetNigoriHandler(&fake_encryption_handler_);
}
virtual void TearDown() {
@@ -568,8 +567,6 @@ class SyncerTest : public testing::Test,
ModelTypeSet enabled_datatypes_;
TrafficRecorder traffic_recorder_;
- FakeSyncEncryptionHandler fake_encryption_handler_;
-
DISALLOW_COPY_AND_ASSIGN(SyncerTest);
};
@@ -727,7 +724,7 @@ TEST_F(SyncerTest, GetCommitIdsFiltersUnreadyEntries) {
sync_pb::EntitySpecifics specifics;
sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
other_cryptographer.GetKeys(nigori->mutable_encrypted());
- fake_encryption_handler_.EnableEncryptEverything();
+ dir_maker_.encryption_handler()->EnableEncryptEverything();
// Set up with an old passphrase, but have pending keys
GetCryptographer(&wtrans)->AddKey(key_params);
GetCryptographer(&wtrans)->Encrypt(bookmark,
@@ -840,7 +837,7 @@ TEST_F(SyncerTest, EncryptionAwareConflicts) {
sync_pb::EntitySpecifics specifics;
sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
other_cryptographer.GetKeys(nigori->mutable_encrypted());
- fake_encryption_handler_.EnableEncryptEverything();
+ dir_maker_.encryption_handler()->EnableEncryptEverything();
GetCryptographer(&wtrans)->SetPendingKeys(nigori->encrypted());
EXPECT_TRUE(GetCryptographer(&wtrans)->has_pending_keys());
}
@@ -1018,8 +1015,8 @@ TEST_F(SyncerTest, NigoriConflicts) {
our_encrypted_specifics.mutable_encrypted());
GetCryptographer(&wtrans)->GetKeys(
nigori->mutable_encrypted());
- fake_encryption_handler_.EnableEncryptEverything();
- GetCryptographer(&wtrans)->UpdateNigoriFromEncryptedTypes(
+ dir_maker_.encryption_handler()->EnableEncryptEverything();
+ directory()->GetNigoriHandler()->UpdateNigoriFromEncryptedTypes(
nigori,
&wtrans);
MutableEntry nigori_entry(&wtrans, GET_BY_SERVER_TAG,
@@ -1029,8 +1026,7 @@ TEST_F(SyncerTest, NigoriConflicts) {
nigori_entry.Put(IS_UNSYNCED, true);
EXPECT_FALSE(GetCryptographer(&wtrans)->has_pending_keys());
EXPECT_TRUE(encrypted_types.Equals(
- GetCryptographer(&wtrans)->GetEncryptedTypes()));
- fake_encryption_handler_.set_cryptographer(GetCryptographer(&wtrans));
+ directory()->GetNigoriHandler()->GetEncryptedTypes(&wtrans)));
}
{
sync_pb::EntitySpecifics specifics;
@@ -1061,8 +1057,8 @@ TEST_F(SyncerTest, NigoriConflicts) {
sync_pb::EntitySpecifics specifics = nigori_entry.Get(SPECIFICS);
ASSERT_TRUE(GetCryptographer(&wtrans)->has_pending_keys());
EXPECT_TRUE(encrypted_types.Equals(
- GetCryptographer(&wtrans)->GetEncryptedTypes()));
- EXPECT_TRUE(fake_encryption_handler_.EncryptEverythingEnabled());
+ directory()->GetNigoriHandler()->GetEncryptedTypes(&wtrans)));
+ EXPECT_TRUE(dir_maker_.encryption_handler()->EncryptEverythingEnabled());
EXPECT_TRUE(specifics.nigori().using_explicit_passphrase());
// Supply the pending keys. Afterwards, we should be able to decrypt both
// our own encrypted data and data encrypted by the other cryptographer,
@@ -1072,7 +1068,9 @@ TEST_F(SyncerTest, NigoriConflicts) {
EXPECT_FALSE(GetCryptographer(&wtrans)->has_pending_keys());
sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
GetCryptographer(&wtrans)->GetKeys(nigori->mutable_encrypted());
- GetCryptographer(&wtrans)->UpdateNigoriFromEncryptedTypes(nigori, &wtrans);
+ directory()->GetNigoriHandler()->UpdateNigoriFromEncryptedTypes(
+ nigori,
+ &wtrans);
// Normally this would be written as part of SetPassphrase, but we do it
// manually for the test.
nigori_entry.Put(SPECIFICS, specifics);
« no previous file with comments | « sync/engine/get_commit_ids_command.cc ('k') | sync/engine/syncer_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698