Reland "[sync::test] Add single client integration test for custom passphrase"

This is a reland of 475bfe9da1df9ab55685e0a9ce1a62d8e50536f1. Fixed test
failures which happened because some DCHECKs had side effects.

Original change's description:
> [sync::test] Add single client integration test for custom passphrase
> Add a Sync integration test which exercises custom passphrase flows, including
> the handling and proper functioning of the newly added key derivation method
> (scrypt).
> Add an integration test helper file for encryption-related tasks and modify
> FakeServer and LoopbackServer to allow easier modification of persistent
> entities such as Nigori. Add passphrase-related functionality to
> ProfileSyncServiceHarness to give tests better control over how and when
> passphrase-based encryption is enabled.
> The test uses a gray-box approach, where it tests the client at the
> ProfileSyncService granularity, but injects and inspects entities on the (fake)
> server to ensure that encryption is performed properly. This is necessary
> because, when it comes to encryption, we are not interested merely in that it
> does not hinder existing functionality (e.g. two clients are syncing data
> properly in the presence of a custom passphrase), but also that it provides the
> expected security to the user. For this reason, we use our knowledge of the
> encryption architecture internals to ensure that the data committed to the
> server is encrypted in the expected way.
> Bug: 894148
> Change-Id: I728f7f18cc0db7b1da50f747a87a640877d0b023
> Reviewed-on:
> Commit-Queue: David Davidović <>
> Reviewed-by: vitaliii <>
> Reviewed-by: Marc Treib <>
> Cr-Commit-Position: refs/heads/master@{#598912}

Bug: 894148
Change-Id: I752acff5815531c0c83ebefb43fb620a785e3ca3
Commit-Queue: David Davidović <>
Reviewed-by: Marc Treib <>
Reviewed-by: vitaliii <>
Cr-Commit-Position: refs/heads/master@{#599182}
14 files changed