| Index: components/sync/base/nigori_unittest.cc
|
| diff --git a/components/sync/base/nigori_unittest.cc b/components/sync/base/nigori_unittest.cc
|
| index 09bbcd75a4039044752a160cee2b5edcaea56335..4dd0e22585a47257e8fd4c3e48d645f9fb74038b 100644
|
| --- a/components/sync/base/nigori_unittest.cc
|
| +++ b/components/sync/base/nigori_unittest.cc
|
| @@ -126,12 +126,13 @@ TEST(SyncNigoriTest, ExportImport) {
|
| Nigori nigori1;
|
| EXPECT_TRUE(nigori1.InitByDerivation("example.com", "username", "password"));
|
|
|
| + std::string user_key;
|
| std::string encryption_key;
|
| std::string mac_key;
|
| - EXPECT_TRUE(nigori1.ExportKeys(&encryption_key, &mac_key));
|
| + EXPECT_TRUE(nigori1.ExportKeys(&user_key, &encryption_key, &mac_key));
|
|
|
| Nigori nigori2;
|
| - EXPECT_TRUE(nigori2.InitByImport(encryption_key, mac_key));
|
| + EXPECT_TRUE(nigori2.InitByImport(user_key, encryption_key, mac_key));
|
|
|
| std::string original("test");
|
| std::string plaintext;
|
| @@ -151,5 +152,30 @@ TEST(SyncNigoriTest, ExportImport) {
|
| EXPECT_EQ(permuted1, permuted2);
|
| }
|
|
|
| +TEST(SyncNigoriTest, InitByDerivationSetsUserKey) {
|
| + Nigori nigori;
|
| + EXPECT_TRUE(nigori.InitByDerivation("example.com", "username", "password"));
|
| +
|
| + std::string user_key = "";
|
| + std::string encryption_key;
|
| + std::string mac_key;
|
| + EXPECT_TRUE(nigori.ExportKeys(&user_key, &encryption_key, &mac_key));
|
| +
|
| + EXPECT_NE(user_key, "");
|
| +}
|
| +
|
| +TEST(SyncNigoriTest, InitByImportToleratesEmptyUserKey) {
|
| + Nigori nigori1;
|
| + EXPECT_TRUE(nigori1.InitByDerivation("example.com", "username", "password"));
|
| +
|
| + std::string user_key;
|
| + std::string encryption_key;
|
| + std::string mac_key;
|
| + EXPECT_TRUE(nigori1.ExportKeys(&user_key, &encryption_key, &mac_key));
|
| +
|
| + Nigori nigori2;
|
| + EXPECT_TRUE(nigori2.InitByImport("", encryption_key, mac_key));
|
| +}
|
| +
|
| } // anonymous namespace
|
| } // namespace syncer
|
|
|