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

Unified Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 10916036: [Sync] Implement keystore migration support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review 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
Index: sync/internal_api/sync_manager_impl_unittest.cc
diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc
index ec08939df59a0a5f0e071b57d88b585956ec26af..74ae9342c97e5400c35001ffd6bddbe2abcd5e69 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -832,7 +832,7 @@ class SyncManagerTest : public testing::Test,
}
if (nigori_status == WRITE_TO_NIGORI) {
sync_pb::NigoriSpecifics nigori;
- cryptographer->GetKeys(nigori.mutable_encrypted());
+ cryptographer->GetKeys(nigori.mutable_encryption_keybag());
share->directory->GetNigoriHandler()->UpdateNigoriFromEncryptedTypes(
&nigori,
trans.GetWrappedTrans());
@@ -1368,10 +1368,10 @@ TEST_F(SyncManagerTest, RefreshEncryptionReady) {
EXPECT_EQ(BaseNode::INIT_OK,
node.InitByIdLookup(GetIdForDataType(NIGORI)));
sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics();
- EXPECT_TRUE(nigori.has_encrypted());
+ EXPECT_TRUE(nigori.has_encryption_keybag());
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->is_ready());
- EXPECT_TRUE(cryptographer->CanDecrypt(nigori.encrypted()));
+ EXPECT_TRUE(cryptographer->CanDecrypt(nigori.encryption_keybag()));
}
}
@@ -1413,10 +1413,10 @@ TEST_F(SyncManagerTest, RefreshEncryptionEmptyNigori) {
EXPECT_EQ(BaseNode::INIT_OK,
node.InitByIdLookup(GetIdForDataType(NIGORI)));
sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics();
- EXPECT_TRUE(nigori.has_encrypted());
+ EXPECT_TRUE(nigori.has_encryption_keybag());
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->is_ready());
- EXPECT_TRUE(cryptographer->CanDecrypt(nigori.encrypted()));
+ EXPECT_TRUE(cryptographer->CanDecrypt(nigori.encryption_keybag()));
}
}
@@ -1508,7 +1508,7 @@ TEST_F(SyncManagerTest, EncryptDataTypesWithData) {
EXPECT_CALL(encryption_observer_, OnEncryptionComplete());
EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_));
EXPECT_CALL(encryption_observer_,
- OnPassphraseStateChanged(CUSTOM_PASSPHRASE));
+ OnPassphraseStateChanged(CUSTOM_PASSPHRASE));
sync_manager_.GetEncryptionHandler()->SetEncryptionPassphrase(
"new_passphrase", true);
EXPECT_TRUE(EncryptEverythingEnabledForTest());
@@ -1561,7 +1561,7 @@ TEST_F(SyncManagerTest, SetInitialGaiaPass) {
sync_pb::NigoriSpecifics nigori = node.GetNigoriSpecifics();
Cryptographer* cryptographer = trans.GetCryptographer();
EXPECT_TRUE(cryptographer->is_ready());
- EXPECT_TRUE(cryptographer->CanDecrypt(nigori.encrypted()));
+ EXPECT_TRUE(cryptographer->CanDecrypt(nigori.encryption_keybag()));
}
}
@@ -1679,8 +1679,8 @@ TEST_F(SyncManagerTest, SupplyPendingGAIAPass) {
WriteNode node(&trans);
EXPECT_EQ(BaseNode::INIT_OK, node.InitByTagLookup(kNigoriTag));
sync_pb::NigoriSpecifics nigori;
- other_cryptographer.GetKeys(nigori.mutable_encrypted());
- cryptographer->SetPendingKeys(nigori.encrypted());
+ other_cryptographer.GetKeys(nigori.mutable_encryption_keybag());
+ cryptographer->SetPendingKeys(nigori.encryption_keybag());
EXPECT_TRUE(cryptographer->has_pending_keys());
node.SetNigoriSpecifics(nigori);
}
@@ -1727,9 +1727,9 @@ TEST_F(SyncManagerTest, SupplyPendingOldGAIAPass) {
WriteNode node(&trans);
EXPECT_EQ(BaseNode::INIT_OK, node.InitByTagLookup(kNigoriTag));
sync_pb::NigoriSpecifics nigori;
- other_cryptographer.GetKeys(nigori.mutable_encrypted());
+ other_cryptographer.GetKeys(nigori.mutable_encryption_keybag());
node.SetNigoriSpecifics(nigori);
- cryptographer->SetPendingKeys(nigori.encrypted());
+ cryptographer->SetPendingKeys(nigori.encryption_keybag());
// other_cryptographer now contains all encryption keys, and is encrypting
// with the newest gaia.
@@ -1810,19 +1810,23 @@ TEST_F(SyncManagerTest, SupplyPendingExplicitPass) {
WriteNode node(&trans);
EXPECT_EQ(BaseNode::INIT_OK, node.InitByTagLookup(kNigoriTag));
sync_pb::NigoriSpecifics nigori;
- other_cryptographer.GetKeys(nigori.mutable_encrypted());
- cryptographer->SetPendingKeys(nigori.encrypted());
+ other_cryptographer.GetKeys(nigori.mutable_encryption_keybag());
+ cryptographer->SetPendingKeys(nigori.encryption_keybag());
EXPECT_TRUE(cryptographer->has_pending_keys());
- nigori.set_using_explicit_passphrase(true);
+ nigori.set_frozen_keybag(true);
node.SetNigoriSpecifics(nigori);
}
+ EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_));
+ EXPECT_CALL(encryption_observer_,
+ OnPassphraseStateChanged(CUSTOM_PASSPHRASE));
+ EXPECT_CALL(encryption_observer_, OnPassphraseRequired(_, _));
+ EXPECT_CALL(encryption_observer_, OnEncryptedTypesChanged(_, false));
+ sync_manager_.GetEncryptionHandler()->Init();
EXPECT_CALL(encryption_observer_,
OnBootstrapTokenUpdated(_, PASSPHRASE_BOOTSTRAP_TOKEN));
EXPECT_CALL(encryption_observer_, OnPassphraseAccepted());
EXPECT_CALL(encryption_observer_, OnEncryptionComplete());
EXPECT_CALL(encryption_observer_, OnCryptographerStateChanged(_));
- EXPECT_CALL(encryption_observer_,
- OnPassphraseStateChanged(CUSTOM_PASSPHRASE));
sync_manager_.GetEncryptionHandler()->SetDecryptionPassphrase("explicit");
EXPECT_EQ(CUSTOM_PASSPHRASE,
sync_manager_.GetEncryptionHandler()->GetPassphraseState());
@@ -1855,9 +1859,9 @@ TEST_F(SyncManagerTest, SupplyPendingGAIAPassUserProvided) {
WriteNode node(&trans);
EXPECT_EQ(BaseNode::INIT_OK, node.InitByTagLookup(kNigoriTag));
sync_pb::NigoriSpecifics nigori;
- other_cryptographer.GetKeys(nigori.mutable_encrypted());
+ other_cryptographer.GetKeys(nigori.mutable_encryption_keybag());
node.SetNigoriSpecifics(nigori);
- cryptographer->SetPendingKeys(nigori.encrypted());
+ cryptographer->SetPendingKeys(nigori.encryption_keybag());
EXPECT_FALSE(cryptographer->is_ready());
}
EXPECT_CALL(encryption_observer_,

Powered by Google App Engine
This is Rietveld 408576698