Commit 16dfd1a7 authored by Maksim Moskvitin's avatar Maksim Moskvitin Committed by Commit Bot

[Sync:USS] Fix ShouldFailOnUnknownPassprase test

We used to check that bridge fails on receiving NigoriSpecifics with
default passphrase type. It's wrong, because default passphrase type
is IMPLICIT_PASSPHRASE, which should be supported.

The purpose of this test is to check that bridge fails on receiving
specifics with some new passphrase type, which is not supported on
current client. With NigoriSpecifics::passphrase_type being converted
to int, it means value out of PassphraseType enum.

Bug: 922900
Change-Id: Ia5bbb39afb17c0a31ba7847d9a1e233cdee4c5dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1862674
Commit-Queue: Maksim Moskvitin <mmoskvitin@google.com>
Auto-Submit: Maksim Moskvitin <mmoskvitin@google.com>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706119}
parent b2026143
...@@ -754,17 +754,19 @@ TEST_F(NigoriSyncBridgeImplTest, ShouldTransitToCustomPassphrase) { ...@@ -754,17 +754,19 @@ TEST_F(NigoriSyncBridgeImplTest, ShouldTransitToCustomPassphrase) {
EXPECT_TRUE(bridge()->HasPendingKeysForTesting()); EXPECT_TRUE(bridge()->HasPendingKeysForTesting());
} }
// Tests that we don't try to overwrite default passphrase type and report // Tests that bridge doesn't try to overwrite unknown passphrase type and
// ModelError unless we received default Nigori node (which is determined by // report ModelError unless it received default Nigori node (which is
// the size of encryption_keybag). It's a requirement because receiving default // determined by the size of encryption_keybag). It's a requirement because
// passphrase type might mean that some newer client switched to the new // receiving unknown passphrase type might mean that some newer client switched
// passphrase type. // to the new passphrase type.
TEST_F(NigoriSyncBridgeImplTest, ShouldFailOnUnknownPassprase) { TEST_F(NigoriSyncBridgeImplTest, ShouldFailOnUnknownPassprase) {
EntityData entity_data; EntityData entity_data;
*entity_data.specifics.mutable_nigori() = *entity_data.specifics.mutable_nigori() =
sync_pb::NigoriSpecifics::default_instance(); sync_pb::NigoriSpecifics::default_instance();
entity_data.specifics.mutable_nigori()->mutable_encryption_keybag()->set_blob( entity_data.specifics.mutable_nigori()->mutable_encryption_keybag()->set_blob(
"data"); "data");
entity_data.specifics.mutable_nigori()->set_passphrase_type(
sync_pb::NigoriSpecifics::TRUSTED_VAULT_PASSPHRASE + 1);
ASSERT_TRUE(bridge()->SetKeystoreKeys({"keystore_key"})); ASSERT_TRUE(bridge()->SetKeystoreKeys({"keystore_key"}));
EXPECT_CALL(*processor(), Put(_)).Times(0); EXPECT_CALL(*processor(), Put(_)).Times(0);
......
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