Commit 334a73b3 authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Add more PASSWORDS integration tests

They verify some otherwise-untested but privacy-sensitive requirements
of what is being sent on the wire, where most (without custom
passphrase) or all (with custom passphrase) proto fields should be
encrypted.

The actual verification is done using the state in the fake server,
which is assumed to store committed content without pruning. This holds
true today and is unlikely to change in the future.

Bug: 856941,870624
Change-Id: I9198ca69c53d55a80f4b2a0c55cd5265e57741aa
Reviewed-on: https://chromium-review.googlesource.com/c/1290809
Commit-Queue: Mikel Astiz <mastiz@chromium.org>
Reviewed-by: default avatarMohamed Amir Yosef <mamir@chromium.org>
Cr-Commit-Position: refs/heads/master@{#601126}
parent b1cb8571
...@@ -41,3 +41,55 @@ IN_PROC_BROWSER_TEST_F(SingleClientPasswordsSyncTest, Sanity) { ...@@ -41,3 +41,55 @@ IN_PROC_BROWSER_TEST_F(SingleClientPasswordsSyncTest, Sanity) {
ASSERT_TRUE(ProfileContainsSamePasswordFormsAsVerifier(0)); ASSERT_TRUE(ProfileContainsSamePasswordFormsAsVerifier(0));
ASSERT_EQ(1, GetPasswordCount(0)); ASSERT_EQ(1, GetPasswordCount(0));
} }
// Verifies that committed passwords contain the appropriate proto fields, and
// in particular lack some others that could potentially contain unencrypted
// data. In this test, custom passphrase is NOT set.
IN_PROC_BROWSER_TEST_F(SingleClientPasswordsSyncTest,
CommitWithoutCustomPassphrase) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
PasswordForm form = CreateTestPasswordForm(0);
AddLogin(GetVerifierPasswordStore(), form);
ASSERT_EQ(1, GetVerifierPasswordCount());
AddLogin(GetPasswordStore(0), form);
ASSERT_EQ(1, GetPasswordCount(0));
ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait());
const std::vector<sync_pb::SyncEntity> entities =
fake_server_->GetSyncEntitiesByModelType(syncer::PASSWORDS);
ASSERT_EQ(1U, entities.size());
EXPECT_EQ("", entities[0].non_unique_name());
EXPECT_TRUE(entities[0].specifics().password().has_encrypted());
EXPECT_FALSE(
entities[0].specifics().password().has_client_only_encrypted_data());
EXPECT_TRUE(entities[0].specifics().password().has_unencrypted_metadata());
EXPECT_TRUE(
entities[0].specifics().password().unencrypted_metadata().has_url());
}
// Same as above but with custom passphrase set, which requires to prune commit
// data even further.
IN_PROC_BROWSER_TEST_F(SingleClientPasswordsSyncTest,
CommitWithCustomPassphrase) {
SetEncryptionPassphraseForClient(/*index=*/0, "hunter2");
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
PasswordForm form = CreateTestPasswordForm(0);
AddLogin(GetVerifierPasswordStore(), form);
ASSERT_EQ(1, GetVerifierPasswordCount());
AddLogin(GetPasswordStore(0), form);
ASSERT_EQ(1, GetPasswordCount(0));
ASSERT_TRUE(UpdatedProgressMarkerChecker(GetSyncService(0)).Wait());
const std::vector<sync_pb::SyncEntity> entities =
fake_server_->GetSyncEntitiesByModelType(syncer::PASSWORDS);
ASSERT_EQ(1U, entities.size());
EXPECT_EQ("", entities[0].non_unique_name());
EXPECT_TRUE(entities[0].specifics().password().has_encrypted());
EXPECT_FALSE(
entities[0].specifics().password().has_client_only_encrypted_data());
EXPECT_FALSE(entities[0].specifics().password().has_unencrypted_metadata());
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment