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

Unified Diff: sync/util/cryptographer_unittest.cc

Issue 10916036: [Sync] Implement keystore migration support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 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 | « sync/util/cryptographer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/util/cryptographer_unittest.cc
diff --git a/sync/util/cryptographer_unittest.cc b/sync/util/cryptographer_unittest.cc
index 1e06b868b7234582c10e0bcc35d71945d1add169..9d1b23646328a9d713d5575dbb8b1468a7d5a996 100644
--- a/sync/util/cryptographer_unittest.cc
+++ b/sync/util/cryptographer_unittest.cc
@@ -183,32 +183,22 @@ TEST_F(SyncCryptographerTest, MAYBE_EncryptExportDecrypt) {
}
}
-// Crashes, Bug 55178.
-#if defined(OS_WIN)
-#define MAYBE_PackUnpack DISABLED_PackUnpack
-#else
-#define MAYBE_PackUnpack PackUnpack
-#endif
-TEST_F(SyncCryptographerTest, MAYBE_PackUnpack) {
- Nigori nigori;
- ASSERT_TRUE(nigori.InitByDerivation("example.com", "username", "password"));
- std::string expected_user, expected_encryption, expected_mac;
- ASSERT_TRUE(nigori.ExportKeys(&expected_user, &expected_encryption,
- &expected_mac));
+TEST_F(SyncCryptographerTest, Bootstrap) {
+ KeyParams params = {"localhost", "dummy", "dummy"};
+ cryptographer_.AddKey(params);
std::string token;
- EXPECT_TRUE(cryptographer_.PackBootstrapToken(&nigori, &token));
+ EXPECT_TRUE(cryptographer_.GetBootstrapToken(&token));
EXPECT_TRUE(IsStringUTF8(token));
- scoped_ptr<Nigori> unpacked(cryptographer_.UnpackBootstrapToken(token));
- EXPECT_NE(static_cast<Nigori*>(NULL), unpacked.get());
+ Cryptographer other_cryptographer(&encryptor_);
+ other_cryptographer.Bootstrap(token);
+ EXPECT_TRUE(other_cryptographer.is_ready());
- std::string user_key, encryption_key, mac_key;
- ASSERT_TRUE(unpacked->ExportKeys(&user_key, &encryption_key, &mac_key));
-
- EXPECT_EQ(expected_user, user_key);
- EXPECT_EQ(expected_encryption, encryption_key);
- EXPECT_EQ(expected_mac, mac_key);
+ const char secret[] = "secret";
+ sync_pb::EncryptedData encrypted;
+ EXPECT_TRUE(other_cryptographer.EncryptString(secret, &encrypted));
+ EXPECT_TRUE(cryptographer_.CanDecryptUsingDefaultKey(encrypted));
}
} // namespace syncer
« no previous file with comments | « sync/util/cryptographer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698