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

Unified Diff: sync/engine/apply_updates_command_unittest.cc

Issue 10827266: [Sync] Add SyncEncryptionHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix 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 | « chrome/browser/sync/profile_sync_service_password_unittest.cc ('k') | sync/engine/conflict_resolver.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/engine/apply_updates_command_unittest.cc
diff --git a/sync/engine/apply_updates_command_unittest.cc b/sync/engine/apply_updates_command_unittest.cc
index 852bfc02b55e491a8af6dbe6755b77e2fb170a38..91fa259e35749decfb65f6eb4e33b836aa4af4fa 100644
--- a/sync/engine/apply_updates_command_unittest.cc
+++ b/sync/engine/apply_updates_command_unittest.cc
@@ -24,6 +24,7 @@
#include "sync/test/engine/syncer_command_test.h"
#include "sync/test/engine/test_id_factory.h"
#include "sync/test/fake_encryptor.h"
+#include "sync/test/fake_sync_encryption_handler.h"
#include "sync/util/cryptographer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -64,14 +65,22 @@ class ApplyUpdatesCommandTest : public SyncerCommandTest {
SyncerCommandTest::SetUp();
entry_factory_.reset(new TestEntryFactory(directory()));
ExpectNoGroupsToChange(apply_updates_command_);
+
+ syncable::ReadTransaction trans(FROM_HERE, directory());
+ directory()->GetCryptographer(&trans)->SetNigoriHandler(
+ &fake_encryption_handler_);
+ fake_encryption_handler_.set_cryptographer(
+ directory()->GetCryptographer(&trans));
}
+ protected:
+ DISALLOW_COPY_AND_ASSIGN(ApplyUpdatesCommandTest);
+
ApplyUpdatesCommand apply_updates_command_;
FakeEncryptor encryptor_;
TestIdFactory id_factory_;
scoped_ptr<TestEntryFactory> entry_factory_;
- private:
- DISALLOW_COPY_AND_ASSIGN(ApplyUpdatesCommandTest);
+ FakeSyncEncryptionHandler fake_encryption_handler_;
};
TEST_F(ApplyUpdatesCommandTest, Simple) {
@@ -534,8 +543,7 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) {
sync_pb::EntitySpecifics specifics;
sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
other_cryptographer.GetKeys(nigori->mutable_encrypted());
- nigori->set_encrypt_bookmarks(true);
- encrypted_types.Put(BOOKMARKS);
+ nigori->set_encrypt_everything(true);
entry_factory_->CreateUnappliedNewItem(
ModelTypeToRootTag(NIGORI), specifics, true);
EXPECT_FALSE(cryptographer->has_pending_keys());
@@ -556,8 +564,7 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdate) {
EXPECT_FALSE(cryptographer->is_ready());
EXPECT_TRUE(cryptographer->has_pending_keys());
- EXPECT_TRUE(
- cryptographer->GetEncryptedTypes().Equals(ModelTypeSet::All()));
+ EXPECT_TRUE(cryptographer->GetEncryptedTypes().Equals(ModelTypeSet::All()));
}
TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) {
@@ -581,10 +588,7 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) {
sync_pb::EntitySpecifics specifics;
sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
other_cryptographer.GetKeys(nigori->mutable_encrypted());
- nigori->set_encrypt_sessions(true);
- nigori->set_encrypt_themes(true);
- encrypted_types.Put(SESSIONS);
- encrypted_types.Put(THEMES);
+ nigori->set_encrypt_everything(true);
entry_factory_->CreateUnappliedNewItem(
ModelTypeToRootTag(NIGORI), specifics, true);
EXPECT_FALSE(cryptographer->has_pending_keys());
@@ -605,8 +609,7 @@ TEST_F(ApplyUpdatesCommandTest, NigoriUpdateForDisabledTypes) {
EXPECT_FALSE(cryptographer->is_ready());
EXPECT_TRUE(cryptographer->has_pending_keys());
- EXPECT_TRUE(
- cryptographer->GetEncryptedTypes().Equals(ModelTypeSet::All()));
+ EXPECT_TRUE(cryptographer->GetEncryptedTypes().Equals(ModelTypeSet::All()));
}
// Create some local unsynced and unencrypted data. Apply a nigori update that
@@ -660,7 +663,7 @@ TEST_F(ApplyUpdatesCommandTest, EncryptUnsyncedChanges) {
sync_pb::EntitySpecifics specifics;
sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
cryptographer->GetKeys(nigori->mutable_encrypted());
- nigori->set_encrypt_bookmarks(true);
+ nigori->set_encrypt_everything(true);
encrypted_types.Put(BOOKMARKS);
entry_factory_->CreateUnappliedNewItem(
ModelTypeToRootTag(NIGORI), specifics, true);
@@ -801,7 +804,7 @@ TEST_F(ApplyUpdatesCommandTest, CannotEncryptUnsyncedChanges) {
sync_pb::EntitySpecifics specifics;
sync_pb::NigoriSpecifics* nigori = specifics.mutable_nigori();
other_cryptographer.GetKeys(nigori->mutable_encrypted());
- nigori->set_encrypt_bookmarks(true);
+ nigori->set_encrypt_everything(true);
encrypted_types.Put(BOOKMARKS);
entry_factory_->CreateUnappliedNewItem(
ModelTypeToRootTag(NIGORI), specifics, true);
« no previous file with comments | « chrome/browser/sync/profile_sync_service_password_unittest.cc ('k') | sync/engine/conflict_resolver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698